Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Help: Unable to run Hobbes test

ChitraKannan
Level 1
Level 1

Hi all - I am new to Hobbes JS. I followed https://docs.adobe.com/docs/en/aem/6-1/develop/components/hobbes.html#par_title_4 and created a test suite with the following test case: 

new hobs.TestSuite("MyTestSuite", {path:"/etc/clientlibs/myFirstTestHobbes/MyFirstTest/myTestSuite.js"})
.addTestCase(new hobs.TestCase("Navigate to projects page")
   .navigateTo("/content/projects/summer.html")
.addTestCase(new hobs.TestCase("Click Topnav  Link")
             .click('a[href="projects.html"]', {expectNav:true})

);

But I am getting error : No tests loaded in Developer mode. Not sure what I am missing. Any help will be much appreciated. Thanks!

1 Accepted Solution
kautuk_sahni
Correct answer by
Employee
Employee

Please refer to :- https://docs.adobe.com/docs/en/aem/6-2/develop/ref/test-api/index.html

// Adding Tests

Steps:

1.Register a "Test js file" Clientlib in the Framework.
2.Create/Register Test Classes.
3.Add Test Cases.
4.Add Actions to a TestCase.

1. In CQ, create a new clienlib (cq:ClientLibraryFolder node), with specific properties:

categories : granite.testing.hobbes.tests
dependencies : granite.testing.hobbes.testrunner
AEM Hobbes.js testrunner (/libs/granite/testing/hobbes.html) now implements in basic filter system based on clientlib category. In order to filter test clientlibs to load, append additionnal categories to granite.testing.hobbes.tests. Example: granite.testing.hobbes.tests.myFeature

Then, use filter URL parameter in the testrunner (hobbes.html?filter=granite.testing.hobbes.tests.myFeature).

2. Register TCase

new hobs.TestSuite("MyTestSuite", {
    path: "<PATH_TO_YOUR_CLIENTLIB>/MyTestSuite.js",
    register: false,
    delay: 2500,
    execBefore: beforeMethod,
    execAfter: afterMethod
})

Please read full article. This should work for you.

~kautuk

View solution in original post

0 Replies
MC_Stuff
Level 9
Level 9

Hi Chitra,

In client library you might have not configured the property categories,dependencies correctly Or the url specified in not correct.  Can you 

Thanks,

kautuk_sahni
Correct answer by
Employee
Employee

Please refer to :- https://docs.adobe.com/docs/en/aem/6-2/develop/ref/test-api/index.html

// Adding Tests

Steps:

1.Register a "Test js file" Clientlib in the Framework.
2.Create/Register Test Classes.
3.Add Test Cases.
4.Add Actions to a TestCase.

1. In CQ, create a new clienlib (cq:ClientLibraryFolder node), with specific properties:

categories : granite.testing.hobbes.tests
dependencies : granite.testing.hobbes.testrunner
AEM Hobbes.js testrunner (/libs/granite/testing/hobbes.html) now implements in basic filter system based on clientlib category. In order to filter test clientlibs to load, append additionnal categories to granite.testing.hobbes.tests. Example: granite.testing.hobbes.tests.myFeature

Then, use filter URL parameter in the testrunner (hobbes.html?filter=granite.testing.hobbes.tests.myFeature).

2. Register TCase

new hobs.TestSuite("MyTestSuite", {
    path: "<PATH_TO_YOUR_CLIENTLIB>/MyTestSuite.js",
    register: false,
    delay: 2500,
    execBefore: beforeMethod,
    execAfter: afterMethod
})

Please read full article. This should work for you.

~kautuk

View solution in original post

Abhishek_Dweved
Employee
Employee

Hi Chitra,

Verify following : 

1/ If you are on AEM6.3 /6.2 , categories and dependencies are going to be different than AEM6.1 ( the article which you are following ) 

           
categoriesString[]granite.testing.hobbes.tests
dependenciesString[]granite.testing.hobbes.testrunner

2/ Check if you can see your test case on following URL instead of developer mode.

http://localhost:4502/libs/granite/testing/hobbes.html

Best Regards,

Abhishek

ChitraKannan
Level 1
Level 1

Thanks all for your input and sorry could not return to the forum for a long time.

I got succesful by switching the browser to Firefox. Not sure why it is not running in Chrome and am not sure if this hobbes JS is browser dependent(on FF)

BTW, we are still using 6.1 and will be upgraded to 6.3 soon.

Thanks again!!