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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Hoang Nguyen
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Approvals_1_1.java (3K) Download Attachment
Payment_Approvals_Preconfig_1.java (3K) Download Attachment
Payment_Comment_Preconfig_1.java (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Nguyen Thai Hoang
I've resolved my issue by separate <test> node in TestNG Test Suite (not combine all class in one <test> as before)






On Friday, September 9, 2016 at 12:41:56 PM UTC+7, Hoang Nguyen wrote:
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 "<a href="http://testng.org/testng-1.0.dtd" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">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 "<a href="http://testng.org/testng-1.0.dtd" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

TotalQA
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.
http://total-qa.com/testng-introduction/order-of-testng-annotations/

Thanks,
total-qa.com

On Wednesday, September 14, 2016 at 12:57:31 PM UTC+5:30, Nguyen Thai Hoang wrote:
I've resolved my issue by separate <test> node in TestNG Test Suite (not combine all class in one <test> as before)

<a href="https://lh3.googleusercontent.com/-b14VXOcrYKM/V9j7pWhfi7I/AAAAAAAAQFw/6T1UR6AS8nwO7NDMlcsGxZ-GGBep4NcOQCLcB/s1600/11.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-b14VXOcrYKM/V9j7pWhfi7I/AAAAAAAAQFw/6T1UR6AS8nwO7NDMlcsGxZ-GGBep4NcOQCLcB/s1600/11.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-b14VXOcrYKM/V9j7pWhfi7I/AAAAAAAAQFw/6T1UR6AS8nwO7NDMlcsGxZ-GGBep4NcOQCLcB/s1600/11.png&#39;;return true;">




On Friday, September 9, 2016 at 12:41:56 PM UTC+7, Hoang Nguyen wrote:
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 "<a href="http://testng.org/testng-1.0.dtd" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">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 "<a href="http://testng.org/testng-1.0.dtd" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.