Just like Junit, TestNG provides very good testing strategies.
This post gives an overview of TestNG - a sample test case.
To you TestNG framework in your project you must use TestNG.jar
Ways To Download:
Official Download Link: TestNG.jar
or
use git clone:
If your using eclipse IDE, you can install TestNG as an eclipse plugin:
Read More...
After downloading TestNG jar file - add that jar to the project build path:
Now you are ready to use TestNG framework.
TestNG test cases uses some important annotations:
All annotations are placed in the package:
org.testng.annotations.*;
@Test
To write a test case - use @Test annotation.
Example:
How to run it?
It is very easy to run a test case in TestNG if your are using an IDE like eclipse
Right Click on Test Case Class->select "Run as" -> TestNG test
More Concepts on TestNG ..coming soon
This post gives an overview of TestNG - a sample test case.
To you TestNG framework in your project you must use TestNG.jar
Ways To Download:
Official Download Link: TestNG.jar
or
use git clone:
git clone git://github.com/cbeust/testng.gitor
If your using eclipse IDE, you can install TestNG as an eclipse plugin:
Read More...
After downloading TestNG jar file - add that jar to the project build path:
Now you are ready to use TestNG framework.
TestNG test cases uses some important annotations:
All annotations are placed in the package:
org.testng.annotations.*;
@Test
To write a test case - use @Test annotation.
Example:
package examples.testng;
import org.testng.annotations.Test;
public class MyFirstTest {
//First Test Case
@Test
public void validUser() {
// write your validation logic
System.out.println("Checking authorization");
}
//Second Test Case
@Test
public void checkBalance() {
// write a business logic to check the balance
System.out.println("Must check balance - before transactions");
}
}
How to run it?
It is very easy to run a test case in TestNG if your are using an IDE like eclipse
Right Click on Test Case Class->select "Run as" -> TestNG test
More Concepts on TestNG ..coming soon
No comments:
Post a Comment