Tutorials Navigation
Apache Ant Tutorial - JUnit Integration
Tutorial Name: Apache Ant Tutorial - JUnit Integration
Category: PC Tutorials
Submitted By: hoot
Date Added:
Comments: 0
Views: 391
Related Forum: PC Building Forum
Share:
JUnit is the commonly used unit testing framework for Java-based developments. It is easy to use and easy to extend. There are a number of JUnit extensions available. If you are unfamiliar with JUnit, you should download it from [ Register or Signin to view external links. ] and read its manual.
This chapter shows how to execute JUnit tests using Ant. Ant makes it straight forward through the JUnit task.
The attributes of the JUnit task are presented below
Sr.No.1-dir
Where to invoke the VM from. This is ignored when fork is disabled.
Sr.No.2-jvm
Command used to invoke the JVM. This is ignored when fork is disabled.
Sr.No.3-fork
Runs the test in a separate JVM
Sr.No.4-errorproperty
The name of the property to set if there is a JUnit error
Sr.No.5-failureproperty
The name of the property to set if there is a JUnit failure
Sr.No.6-haltonerror
Stops execution when a test error occurs
Sr.No.7-haltonfailure
Stops execution when a failure occurs
Sr.No.8-printsummary
Advises Ant to display simple statistics for each test
Sr.No.9-showoutput
Advises Ant to send the output to its logs and formatters
Sr.No.10-tempdir
Path to the temporary file that Ant will use
Sr.No.11-timeout
Exits the tests that take longer to run than this setting (in milliseconds).
Let us continue the theme of the Hello World Fax web application and add a JUnit target.
The following example shows a simple JUnit test execution
<target name = "unittest">
<junit haltonfailure = "true" printsummary = "true">
<test name = "example.UtilsTest"/>
</junit>
</target>
This example shows the execution of JUnit on the com.tutorialspoint.UtilsTest junit class. Running the above code produces the following output
test:
[echo] Testing the application
[junit] Running com.example.UtilsTest
[junit] Tests run: 12, Failures: 0, Errors: 0, Time elapsed: 16.2 sec
BUILD PASSED
Ratings
Comments
Related Tutorials
- 01. Emulating Xbox 360 on PC for Running COD4 With Mods(3,500)
- 02. How to: Matrix Numbers | Batch File(1,908)
- 03. How to Password Protect Files on Windows(857)
- 04. How to play Socom 2/3/ and Combined Assault on PC(6,737)
- 05. Modern Warfare 2 Vac Ban Bypass Tutorial(6,147)
- 06. How to embed an image on TheTechGame(3,100)
- 07. [PC] NIOH 2 OTHER USER SAVE RESIGN(13,004)
- 08. Host bot lobbies! Full Tutorial!(11,294)
- 09. Unban yourself [Plutonium BO2](14,243)
- 10. Fall Guys - How to Change Your Name Color on Fall Guys(8,390)
- 11. Best Crosshair Settings for Valorant(6,529)
- 12. Othercide The Surgeon Boss Guide(2,544)
- 13. Othercide Remembrances Unlock Guide(4,470)
- 14. Othercide Beginners Tips and Tricks(2,712)
- 15. How to Fix Grounded Crashes, Loading Time, Low FPS and Other(4,848)
"Apache Ant Tutorial - JUnit Integration" :: Login/Create an Account :: 0 comments