Skip to content
Advertisement

How to extract testNG results in Jenkins console using Linux command

I’m trying to extract the user who is triggered the Jenkins job and testNG execution status from Jenkins console.

Need to get below details from Jenkins console using Linux command.

Jenkins console log:

Started by user achuMohan

===============================================

TransferMoneyTest

Tests run: 10, Pass: 5 Failures: 3, Skips: 2

===============================================

Output:

JavaScript

I tried the below command to get all the console logs but not sure how can I proceed further.

JavaScript

I want to fetch the above output and store it into the variable as like above.

Is it possible to extract only above things from the entire console log by using linux command else anyother way to achieve?

Advertisement

Answer

You can use below command to get the test result data :

JavaScript

The output of the above command will be :

JavaScript

For username you can use below command :

JavaScript

This will give output as :

JavaScript

You can put these data into a file and then use cat to print it on terminal.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement