Skip to main content
´╗┐
Content Starts Here

How to get Jenkins environment variables in ReadyAPI when ReadyAPI test is being ran with Jenkins?

Question
How to get Jenkins environment variables in ReadyAPI when ReadyAPI test is being ran with Jenkins?
Answer
When a ReadyAPI test is started from Jenkins, you can get access to the environment variables set by Jenkins.To get a particular Jenkins environment variable, you can refer to it in the following way in your groovy script:
System.getenv("VAR_NAME")

Here, VAR_NAME is the Jenkins environment variable name you need to address. For example, the following code posts Jenkins build number to the log:
log.info 'Jenkins build number: ' + System.getenv("BUILD_NUMBER")

You can find the list of available Jenkins environment variables here.
Previous MonthNext Month
SunMonTueWedThuFriSat
       
       
       
       
       
       
´╗┐