TestNG is a testing framework written by Java and inspired from JUnit and NUnit, it is not only inherited existing functionality from Junit as well as introducing some new innovative functionality that make it powerful, easy to use, reliable, maintainable and testable codes. TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc. we can take full advantage of TestNG from engineering to quality insurance.
The TestNG project aims to help developers take the next step—the NG stands for “next generation” — enabling broader and deeper test coverage that encompasses not only unit tests but also acceptance, functional, and integration tests.
Содержание
What’s TestNG features?
- Annotations. (JDK 5 new features, if unfamiliar with annotations, you should familer with it.)
- Test that your code is multithread safe.
- Using XML do Flexible test configuration.
- Support for data-driven testing (with @DataProvider).
- Powerful execution model (no more TestSuite).
- Dependent methods for application server testing.
- Supported ignore, time, parameters, Suite and exception Test.
- Supported by Eclipse, IDEA, Ant, Maven, Netbean, Hudson and so on.
- Test that your source code is multithread-safe.
- Never superfluous code, No required extend specified class.
- Easy to migrate from JUnit
Get ready to learn? – Working TesNG case in Eclipse
- Testng eclipse tutorial – Install and use testng eclipse plugin
The TestNG Eclipse plug-in allows you integrate testNG cases with Eclipse.
TestNG tutorials and examples
- TestNG Tutorials 1 – Getting Started
Introduce how to install TestNG, start your first test class and run it with IDEA, command or even Ant. - TestNG Tutorials 2 – TestNG Basic Concepts and Annotations
Introduce all basic TestNG concepts and annotations, you will be able to learn more TestNG features from here. - TestNG Tutorials 3 – Expectedexception Test
The ‘ExpectedException’ attribute allow you more control on the checks to be performed on the expected Exception via a test method in TestNG engine. - TestNG Tutorials 4 – Ignore Test
Not all tests are ready to execute or pass at first instance, TestNG engine has built-in support for ignoring specific tests without needing to introduce changes to your codebase. - TestNG Tutorials 5 – Time Test with Annotation Timeout
Specify the amount of time in a given time unit that make fail if the case take longer time than it. - TestNG Tutorials 6 – Group Test
Introduce the new innovative feature “group test” in TestNG. - TestNG Tutorials 7 – Suite Test
Bundle a few unit test cases and run it together. - TestNG Tutorials 8 – Dependency Test
Introduce how to perform the dependency testing with TestNG.
Generate code Coverage with TestNG
- TestNG with Cobertura – generate code coverage report
How to generate code coverage report accessed by TestNG tests. - Look at coverage tool: Cobertura, Clover and Eclemma
Introduce coverage tools: Cobertura vs Clover vs Eclemma.
Thank you for sharing your info. I truly
appreciate your efforts and I am waiting for your
further post thanks once again.
Can u tell how to get the subsuit tests into single test????
Can you please tell more a little bit specific, like an example.
My testing.xml contains 3 tests as below:
I need to run only CheckODARurl method without commenting others using the command line. I am using below command line but it is executing all the 3 tests. Can any one let me know what I am doing wrong here :
C:\Users\asin152\Documents\Java 2014\Projects\Smoke_ODAR>java org.testng.TestNG \bin\config\testing.xml -methods scripts.TestNgLogin.CheckODARurl