Expertiza documentation: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 26: Line 26:


TestNG is inspired from JUnit and Nunit, with additional functionalities such as Flexible test configuration, support for data driven testing, etc.
TestNG is inspired from JUnit and Nunit, with additional functionalities such as Flexible test configuration, support for data driven testing, etc.


{| {{table}}
{| {{table}}
Line 52: Line 49:
| ||||||
| ||||||
|-
|-
| ||||||
|  
|}
 
 
== Some other JAVA testing units ==
 
{| {{table}}
| align="center" style="background:#f0f0f0;"|''''''
| align="center" style="background:#f0f0f0;"|'''JEasyTest'''
| align="center" style="background:#f0f0f0;"|'''J2ME Unit Testing Toolkit'''
| align="center" style="background:#f0f0f0;"|'''Jailer'''
| align="center" style="background:#f0f0f0;"|'''Mockrunner'''
|-
| Features||Generates coverage report Allows virtual mock object||Is a  Java 2 Micro Edition (J2ME) library containing a unit testing framework for J2ME||Does test data exporting.  JDBC agnostic  Generates DbUnit datasets, hierarchically structured XML, and topologically sorted SQL-DML.||A lightweight framework for unit testing applications in the J2EE environment.
|-
| Integrates with:||ECLIPSE 3.3||ANT ||Platform Independent||OS independent
|-
|-
|  
|  
|}
|}

Revision as of 16:31, 21 September 2009

Plenty of Testing framework exist for Java. JUnit has been the de facto standard for unit testing. However, other frameworks such as TestNG, JTIGER have been built to address various faults and deficiencies with JUnit. Our primary objective is to compare the various testing frameworks that exist for object oriented languages based on the primary purpose of the framework, strength, platforms that are supported by them, etc and thus help in choosing the best testing framework that fits in a particular suitable environment.


TestNG is a testing framework which can help to meet a broad range of testing such as unit testing, integration testing, functional testing, end-to -end testing.

To write a TESTNG test, we need to: Write the business logic of the test, and insert the TestNG annotations in them. Add the information about our test (such as: the class name, the groups we wish to run, etc) in a testing.xml file or in build.xml. Run the test. TestNG supports data driven testing

TestNG is invoked in several different ways: With a testing.xml file ANT Command line


It is possible to group the test methods of TestNG. We can declare methods that belong to these groups and specify groups that contain other groups. It is very flexible as it can help in choosing one set of regular expression and excluding the other sets. This splits the various test groups and there is no need to recompile again if we want to run two different tests back to back.

Requirements: JDK 1.4, 1.5 Invoked in many environments such as command line, ant, ECLIPSE, IDEA, MAVEN, etc

The annotations available in TestNG can be found at: http://testng.org/doc/documentation-main.html#annotations

TestNG is inspired from JUnit and Nunit, with additional functionalities such as Flexible test configuration, support for data driven testing, etc.

' JUnit4 TestNG Cactus
Supporting Type of Testing Suitable more for Unit testing Supports Unit testing,Functional testing, end-to-end testing, integration testing Primarily unit testing. Also have frameworks for code logic unit testing , functional logic unit testing
Conventions Rigid Example: Flexible Not as flexible as TestNG
Derived from JUnit Yes, from the previous versions Inspired from Junit,with added functionalities Extends JUnit
Init () Init() has to be declared static Not necessary
Flexibility for large suites Not flexible for large test suites, Flexible for running large test suites of code and thus one test\'s failure shouldn\'t mean having to rerun a suite of thousands. No, it is suitable for unit testing.
Suitable for Best for a single object Best for a higher level testing Best for server-side java code such as Servlets, EJB, etc.
Runs on Command line, ANT,ECLIPSE Command line,ANT, ECLIPSE, IDEA,MAVEN ECLIPSE


Some other JAVA testing units

' JEasyTest J2ME Unit Testing Toolkit Jailer Mockrunner
Features Generates coverage report Allows virtual mock object Is a Java 2 Micro Edition (J2ME) library containing a unit testing framework for J2ME Does test data exporting. JDBC agnostic Generates DbUnit datasets, hierarchically structured XML, and topologically sorted SQL-DML. A lightweight framework for unit testing applications in the J2EE environment.
Integrates with: ECLIPSE 3.3 ANT Platform Independent OS independent