Reputation: 1
I was creating a demo framework for Open MRS Application using POM design. The credentials for the Application are "admin/Admin123"
I created the following 3 Classes:
1) Login tests: Which contains all the Login (1 +ve and 2 -ve scenarios) and Logout test (Total 4 @Tests)
2) Register Patient test: Which will register a patient and also verify if the patient has been registered successfully (Total 3 +ve @Tests)
3) Capture Vitals test: Which will Capture Vitals of the patient registered above and verify if the details captured are correct. (Total 2 +ve @Tests)
I'm planning to add a few more Classes which will contain tests related to Adding Visits, adding Allergies etc.
There is a dependency between the classes i.e. only execute the Register patient test if the @Test for Login passes. Similarly, execute the remaining tests like capture vitals, adding visits, adding allergies only if the Register patient test passes. However, there is no dependency between the capture vitals, adding visits and adding allergies and can run in parallel.
This is how it looks from a top-level:
class Login
@Test T_001_LoginTest
@Test T_002_LogoutTest
class RegisterPatient
@Test T_003_RegisterNewPatient
@Test T_004_ConfirmPatientRegisteredUsingPatientID (dependent on T_003)
@Test T_005_ConfirmPatientRegisteredUsingPatientName (dependent on T_003)
class CaptureVitalsTest
@Test T_006_CreateAVisitAndCaptureVitals (dependent on T_001 and T_003)
@Test T_007_VerifyVitals (dependent on T_006)
What I have done so far is added defined group "login" for class Login and group "registerpatient" for class Register. For class RegisterPatient, I've added dependsOnGroup "login". Similarly, for class CaptureVitals, I've added dependsOnGroups for both "login" and "registerpatient". I've also set alwaysRun = true for the @Test Methods which have "dependsOnMethods" dependency.
Below is my testng.xml file
<suite name="Open MRS Automation" parallel="tests">
<listeners>
<listener class-name="com.utils.CustomListener" />
</listeners>
<test thread-count="5" name="Login Test">
<classes>
<class name="com.testcases.LoginTest" />
</classes>
</test> <!-- Test -->
<test thread-count="5" name="Register Patient Tests">
<classes>
<class name="com.testcases.RegisterPatientTest" />
</classes>
</test>
<test thread-count="5" name="Capture Vitals Tests">
<classes>
<class name="com.testcases.CaptureVitalsTest" />
</classes>
</test>
</suite>
What would be the right approach in setting initial sequential and then parallel execution of the tests? Any help would be appreciated! Thanks.
Upvotes: 0
Views: 199
Reputation: 319
You should give Testcases method name by numbers. you must be using excel sheet for data provider format that will help you run test cases according to Testcases number
Upvotes: 1