I have following queries
1. @BeforeGroup and @AfterGroup annotations works only when I include groups parameter for these annotations. These annotations are not invoked even when I include alwaysRun=true. Why?
Annotations:
// test case 2
@Test(enabled=true,invocationCount=2,priority=1,alwaysRun=true,groups={"checkintest"})
public void testCase2() {
System.out.println("in test case 2");
}
@BeforeMethod(alwaysRun=true)
public void beforeMethod() {
System.out.println("in beforeMethod");
}
@AfterMethod(alwaysRun=true)
public void afterMethod() {
System.out.println("in afterMethod");
}
@BeforeClass(alwaysRun=true)
public void beforeClass() {
System.out.println("in beforeClass");
}
@AfterClass(alwaysRun=true)
public void afterClass() {
System.out.println("in afterClass");
}
@BeforeTest(alwaysRun=true)
public void beforeTest() {
System.out.println("in beforeTest");
}
@AfterTest(alwaysRun=true)
public void afterTest() {
System.out.println("in afterTest");
}
@BeforeSuite(alwaysRun=true)
public void beforeSuite() {
System.out.println("in beforeSuite");
}
@AfterSuite(alwaysRun=true)
public void afterSuite() {
System.out.println("in afterSuite");
}
@BeforeGroups(groups={"checkintest"})
public void beforeGroup() {
System.out.println("in beforeGroup");
}
@AfterGroups(groups={"checkintest"})
public void afterGroup() {
System.out.println("in afterGroup");
}
@Test(dependsOnMethods="testCase2",groups={"checkintest"})
public void testCase1(){
System.out.println("in testCase1");
}
TestNG.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "
http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="none">
<test name="Test">
<classes>
<class name="POC">
</class>
</classes>
<groups>
<run>
<include name="checkintest"/>
<exclude name="broken"/>
</run>
</groups>
</test> <!-- Test -->
</suite> <!-- Suite -->
2. I'm trying to run TestNG using Command Prompt and I have learned that I need to set up environment variable in Windows called CLASSPATH. Here, I would like to know why the CLASSPATH value can't include only Directory information of testNG jar instead of jar itself.
Ex:
The below value works fine
C:\Kaleem\Eclipse\eclipse\plugins\org.testng.eclipse_6.9.5.201506120235\lib\testng.jar;C:\Kaleem\Eclipse\eclipse\plugins\org.testng.eclipse_6.9.5.201506120235\lib\bsh-2.0b4.jar;C:\Kaleem\Eclipse\eclipse\plugins\org.testng.eclipse_6.9.5.201506120235\lib\guava-base-r03.jar;C:\Kaleem\Eclipse\eclipse\plugins\org.testng.eclipse_6.9.5.201506120235\lib\guava-collections-r03.jar;C:\Kaleem\Eclipse\eclipse\plugins\org.testng.eclipse_6.9.5.201506120235\lib\jcommander.jar;C:\Kaleem\Eclipse\eclipse\plugins\org.testng.eclipse_6.9.5.201506120235\lib\snakeyaml.jar;C:\Kaleem\Eclipse\eclipse\plugins\org.testng.eclipse_6.9.5.201506120235\lib\testng-sources.jar;C:\Kaleem\EclipseWorkSpace\;
But this value doesn't
C:\Kaleem\Eclipse\eclipse\plugins\org.testng.eclipse_6.9.5.201506120235\lib\;C:\Kaleem\EclipseWorkSpace\;
3. While running Testng.xml file from command prompt one needs to provide the relative path of xml file otherwise, it looks into the current folder.
Why can't it look in to CLASSPATH workspace i.e. C:\Kaleem\EclipseWorkSpace\?
Thanks,
Kaleem.