Using Test NG for Test Harness

Using Test NG for Test Harness

TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers).

Writing a test is typically a three-step process:

  • Write the business logic of your test and insert TestNG annotations in your code.
  • Add the information about your test (e.g. the class name, the groups you wish to run, etc…) in a testng.xml file or in build.xml.
  • Run TestNG.

Basic concepts:

  • A suite is represented by one XML file. It can contain one or more tests and is defined by the tag.
  • A test is represented by and can contain one or more TestNG classes.
  • A TestNG class is a Java class that contains at least one TestNG annotation. It is represented by the tag and can contain one or more test methods.
  • A test method is a Java method annotated by @Test in your source.

A TestNG test can be configured by @BeforeXXX and @AfterXXX annotations which allows to perform some Java logic before and after a certain point, these points being either of the items listed above.

TestNG Annotations

@BeforeSuite
@AfterSuite
@BeforeTest
@AfterTest
@BeforeGroups
@AfterGroups
@BeforeClass
@AfterClass
@BeforeMethod
@AfterMethod

 For details click here

This is a modified version of the TestNG Documentation from http://testng.org/ kindly refer to the actual site for any updated documentation.

One Response so far.

  1. smemevach says:

    Best reviews of the day about Watch sport, Monday night sport in, sport pics and Official sport sites http://facilmundo.com !
    Most actual news about Need car speed unleashed and Car dealers http://todostierra.com !!

Leave a Reply

Your email address will not be published. Required fields are marked *