dependent tests

4 views
Skip to first unread message

Ashish

unread,
Jul 28, 2006, 2:15:44 PM7/28/06
to testng-users
Hi,
I'm using the dependency feature of TestNG and
its giving me some trouble.
Excerpts from the test class

@BeforeTest(groups = {"setup"})
public void setUp() throws Exception {
..
}

@Test(groups = { "a", "performance-group", "regression-group" },
dependsOnGroups = {"setup"} )
public void dependencyTest() {
..
}

The report says the no groups with 'setup' found:
java.lang.Throwable: Method example.ExampleTest.dependencyTest()
depends on nonexistent group "setup"
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:866)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:687)
...

Any ideas ?

Thanks
Ashish

Cédric Beust ♔

unread,
Jul 28, 2006, 2:23:34 PM7/28/06
to testng...@googlegroups.com
Hi Ashish,

Are you including the group "setup" in your run?

If not, then TestNG will ignore your setUp() method and then later, when it tries to find out all the groups, it won't see "setup"...

--
Cedric


On 7/28/06, Ashish <ashish...@gmail.com> wrote:

Hi,
I'm using the dependency feature of TestNG and
its giving me some trouble.
Excerpts from the test class

@BeforeTest(groups = {"setup"})
public void setUp() throws Exception {
..
    }

@Test(groups = { "a", "performance-group", "regression-group" },
          dependsOnGroups = {"setup"} )
public void dependencyTest() {
..
}

The report says the no groups with 'setup' found:
java.lang.Throwable: Method example.ExampleTest.dependencyTest()
depends on nonexistent group "setup"
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:866)
        at org.testng.internal.TestMethodWorker.run (TestMethodWorker.java:109)

        at org.testng.TestRunner.privateRun(TestRunner.java:687)
...

Any ideas ?

Thanks
Ashish







--
Cédric

Ashish

unread,
Jul 28, 2006, 4:34:57 PM7/28/06
to testng-users
The method setUp() is being executed - see the printlns from it on the
console.
That should be good enough to include the group 'setup' in the run,
right ?

The testng.xml file contains the test classname to be executed
<suite ....>
...
<class name="ExampleTest"/>
...
</suite>


Thanks
Ashish

Cédric Beust ♔

unread,
Jul 28, 2006, 5:03:05 PM7/28/06
to testng...@googlegroups.com
Ashish,

You can only depend on test methods, not configuration methods (@BeforeTest), which is implicit.

Since you have no @Test method that belongs to the group "setup", TestNG skips your test (note that this is the result I'm seeing with your code:  your test method is skipped).

Add a @Test(groups = "setup") method and you should get the expected result.

--
Cedric



On 7/28/06, Ashish < ashish...@gmail.com> wrote:



--
Cédric
Reply all
Reply to author
Forward
0 new messages