Thursday, February 14, 2013

Ant task to print all the test environment information

Below are the list of ant properties that gives the information about test environment. For example, if you want to know which java version is used, we can use "ant.java.version" property in the "echo" tag to print in the ant console. Similarly, for 

ant version - ant.version 
current project name - ant.project.name 
current user name - user.name 
current user directory - user.dir 

Below is the ant code to do this:
 
 
 
  
  
  
  
  
 
You will get the following message in your console:
Buildfile: /Users/aksahu/MySpace/Web_Workspace/AutoTest/build.xml
info:
     [echo] Java Version : 1.6
     [echo] Ant Version : Apache Ant version 1.7.1 compiled on June 27 2008
     [echo] Project Name : autoTest
     [echo] User Name : aksahu
     [echo] Project Location : /Users/aksahu/MySpace/Web_Workspace/AutoTest
BUILD SUCCESSFUL
Total time: 753 milliseconds

No comments:

Post a Comment