This is a draft cheat sheet. It is a work in progress and is not finished yet.
Course of action
1. Write the test and insert annotations into the code |
2. Add test info to testng.xml |
3. Run TestNG |
Basic annotations
@BeforeSuite |
Run once before the test suite |
@AfterSuite |
Run once after the test suite |
@BeforeClass |
Run once before the test class |
@AfterClass |
Run once after the test class |
@BeforeTest |
Run once before each test in class |
@AfterTest |
Run once after each test in class |
@Test |
Mark class or method as test |
|
|
testng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1">
<test name="test1">
<classes>
<class name="TestngTestClassName"/>
</classes>
</test>
</suite>
|
|