[Question] Order running of TestNG class while using Group dependency

57 views
Skip to first unread message

Hoang Nguyen

unread,
Sep 9, 2016, 1:41:56 AM9/9/16
to testng-users
Hi all,

I've met a strange issue related to the order running of TestNG class

1. Below is my TestNG Testsuite without using Group Dependency


<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Notifications" verbose="10">
<test name="Suite">
<classes>
<class name="TestLab.Sep43h21.Notifications.Payment_Approvals_Preconfig_1" />
<class name="TestLab.Sep43h21.Notifications.Approvals_1_1" />
<class name="TestLab.Sep43h21.Notifications.Payment_Comment_Preconfig_1" />
</classes>
</test>
</suite>

In this scenario, it will run with order class:
- Payment_Approvals_Preconfig_1
- Approvals_1_1
- Payment_Comment_Preconfig_1

2. But when I use Group Dependency as below:


<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Notifications" verbose="10">
<test name="Suite">
<groups>
<dependencies>
<group name="Approvals_1_1" depends-on="Payment_Approvals_Preconfig_1" />
</dependencies>
</groups>
<classes>
<class name="TestLab.Sep43h21.Notifications.Payment_Approvals_Preconfig_1" />
<class name="TestLab.Sep43h21.Notifications.Approvals_1_1" />
<class name="TestLab.Sep43h21.Notifications.Payment_Comment_Preconfig_1" />
</classes>
</test>
</suite>

In this scenario, it will run with order class, that is not my expectation:
- Payment_Approvals_Preconfig_1
- Payment_Comment_Preconfig_1
- Approvals_1_1

Note 1: All classes will run successful.
Note 2: Attachments is my classes, I separate one real test case into one class.

How I can fix it, many thanks.
Approvals_1_1.java
Payment_Approvals_Preconfig_1.java
Payment_Comment_Preconfig_1.java

Nguyen Thai Hoang

unread,
Sep 14, 2016, 3:27:31 AM9/14/16
to testng-users
I've resolved my issue by separate <test> node in TestNG Test Suite (not combine all class in one <test> as before)



tota...@gmail.com

unread,
Mar 3, 2018, 7:36:48 PM3/3/18
to testng-users
For Complete Understanding all the Annotations in Testng. Please refer to the link.
It has real time example which gives clarity about the testng annotations.

Thanks,
Reply all
Reply to author
Forward
0 new messages