I have an initialize test class that includes test methods that do some initialization setup for the rest of the classes. My initialize class looks as follows:
public class TP397_Procedure1_Initialize extends BaseClass
{
@FrameworkAnnotation(author = { "author" }, deviceType="abc")
@Test(description="Delete All Patients", groups="Primary" )
public void deleteAllPatients()
{
.
.
.
}
@FrameworkAnnotation(author = { "author" }, deviceType="abc")
@Test(description="Create new patient", groups="Primary" )
public void createNewPatients()
{
.
.
.
}
and so on...
}
I want the rest of the classes to be dependent on this class. So even if a single @Test fails in initialize, all the @Tests in the rest of the classes should skip.
I was able to achieve this using the suggestion by
tind...@gmail.com in the following post:
My question is, instead of manually expecting test writers to add the groups to all their testcases, (which they might forget to do for some), can I programmatically have all my tests under all classes except class initialize automatically get this depends on groups added to each @Test?
So it should look as follows:
@Test(description = "OR Session Is Not Created When IPG And Lead Details Are Not Configured", priority = 0, groups= {"Dependency"})
My suite xml will be as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "
https://testng.org/testng-1.0.dtd">
<suite name="TP397_Procedure1">
<test thread-count="5" name="Procedure1">
<parameter name="TP_ID" value="TP397" />
<parameter name="deviceName" value="R52N20ALVDN" />
<parameter name="platformVersion" value="10" />
<parameter name="portNumber" value="4723" />
<groups>
<dependencies>
<group name="Dependency" depends-on="Primary" />
</dependencies>
</groups>
<classes>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Initialize"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section01"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section02"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section03"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section04"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section05"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section06"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section07"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section08"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section09"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_Section10"/>
<class name="CPAutomationTestSuite.TP_000397.Procedure1.TP397_Procedure1_TearDown"/>
Thank you