Depends-on group from another suite file

34 views
Skip to first unread message

dr29...@gmail.com

unread,
May 30, 2024, 12:28:28 PMMay 30
to testng-users
Given a parent suite with multiple xml child suites:

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Parent suite">
<suite-files>
<suite-file path="component_a.xml"/>
<suite-file path="component_b.xml"/>
<suite-file path="component_c.xml"/>
</suite-files>
</suite>


Child suite sample:
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Regression suite">
<test name="Component A">
<groups>
<run>
<include name="A"/>
</run>
</groups>
<packages>
<package name="com.org.suites.*"/>
</packages>
</test>
</suite>

How to make all of the child suites depend on a new `smoke` suite?
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Regression suite">
<test name="Smoke">
<groups>
<run>
<include name="smoke"/>
</run>
</groups>
<packages>
<package name="com.org.suites.smoke.*"/>
</packages>
</test>
</suite>

Introducing hard dependency in a child xml :
<groups>
<run>
<include name="A"/>
</run>
<dependencies>
<group name="A" depends-on="smoke"/>
</dependencies>
</groups>

does not seem to work
org.testng.TestNGException:
DependencyMap::Method "RegressionTest.regressionTest()..." depends on nonexistent group "smoke"


Thanks

Krishnan Mahadevan

unread,
May 30, 2024, 10:17:05 PMMay 30
to testng...@googlegroups.com
I don’t think you can establish dependency across suites. 

A quick way of doing this would be to store the state into a singleton which would then be queried by the suites to determine if they can proceed further or not. 

So the parent suite would set the state which the child suite would query. I don’t remember at the top of my head if the ordering is guaranteed when running a suite of suites wherein the master suite is just a container to house child suites. You might want to keep an eye out on that aspect as well. 

Hope that helps. 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

From: testng...@googlegroups.com <testng...@googlegroups.com> on behalf of dr29...@gmail.com <dr29...@gmail.com>
Sent: Thursday, May 30, 2024 9:58:28 PM
To: testng-users <testng...@googlegroups.com>
Subject: [testng-users] Depends-on group from another suite file
 
--
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 testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/a3c041a4-8501-4f09-b26c-86f10eb5e884n%40googlegroups.com.

dr29...@gmail.com

unread,
May 31, 2024, 10:50:58 AMMay 31
to testng-users
The share state of a singleton works for me.

Thank you for the suggestion!
Reply all
Reply to author
Forward
0 new messages