Hi All,
I'm going through the documentation which is mentioned @
http://testng.org/doc/documentation-main.html#annotationtransformersI just completed the annotations part and I have the following queries
1. Why we are allowing more than one method to use the same annotation. In the below piece of code @BeforeMethod is used twice.
2. When I use alwaysRun=true,enabled=false, here the preference is always given to enable. Why?
3. The following is the output when I right clicked the TestNG.xml and said RunAs->TestNG. In this output, I can't find my Annotations output, Why?
[TestNG] Running:
C:\Kaleem\EclipseWorkSpace\DellCSW\TestNG.xml
in test case 2
in test case 2
in test case 2
in test case 1
===============================================
Suite1
Total tests run: 4, Failures: 0, Skips: 0
===============================================
4. When I right click the .java file and say Runas->TestNG the eclipse IDE throws exception for not implementing Add and Delete method. Here, I don't implement any interface but why this error message?
Note: For this scenario I'm not including TestNG.xml file.
My Annotations: // test case 1
@Test(dependsOnMethods="testCase2",groups={"checkinTests"})
public void testCase1() {
System.out.println("in test case 1");
}
// test case 2
@Test(alwaysRun=true,enabled=false,invocationCount=3,groups={"checkinTests"})
public void testCase2() {
System.out.println("in test case 2");
}
@BeforeMethod
public void beforeMethod() {
System.out.println("in beforeMethod");
}
@BeforeMethod
public void beforeMethod1() {
System.out.println("in beforeMethod");
}
@AfterMethod
public void afterMethod() {
System.out.println("in afterMethod");
}
@BeforeClass
public void beforeClass() {
System.out.println("in beforeClass");
}
@AfterClass
public void afterClass() {
System.out.println("in afterClass");
}
@BeforeTest
public void beforeTest() {
System.out.println("in beforeTest");
}
@AfterTest
public void afterTest() {
System.out.println("in afterTest");
}
@BeforeSuite
public void beforeSuite() {
System.out.println("in beforeSuite");
}
@AfterSuite
public void afterSuite() {
System.out.println("in afterSuite");
}
@BeforeGroups
public void beforeGroup() {
System.out.println("in beforeGroup");
}
@AfterGroups
public void afterGroup() {
System.out.println("in afterGroup");
}
My TestNG.xml file:
<suite name="Suite1" verbose="1" >
<test name="Regression1">
<classes>
<class name="POC"/>
</classes>
<groups>
<run>
<exclude name="brokenTests" />
<include name="checkinTests" />
</run>
</groups>
</test>
</suite>
Thanks,
Kaleem.