grouping test in testng code example

Example: group test in testng

I use groups annotation for defining the groups in code part. Then I open 
my xml file, 
I create a suite tag, I put groups tag into it
Also there is a run tag which represent the group that needs to be run.
Important tag is include tag. It represents the name of the group that needs 
to be executed.


@Test (groups={"smokeTest”, ”functionalTest”})
public void loginTest(){
	System.out.println("Logged in successfully”);
}

<suite name="Time test Suite" verbose="1">
  <test name="Group Test">
    <groups>
      <run>
        <include name="test-group" />
      </run>
    </groups>
    <classes>
      <class name="com.howtodoinjava.groupExamples.TestGroupExample" />
    </classes>
  </test>
</suite>

Tags:

Misc Example