Home > Mobile >  How to parse the jenkins log at the postbuild and display text?
How to parse the jenkins log at the postbuild and display text?

Time:11-24

In my script I have added "TestResult => Test description => Pass" and "TestResult => Test Description => Fail" as per the need. As part of the post build , the lines start with TestResult and contains => should be displayed. I added post build groovy script but the result is not showing post build output.

Below is my sample execute shell

enter image description here

below is my post build groovy script enter image description here

But in the result ,I am not seeing groovy file post build output at all

enter image description here

What am I missing?

CodePudding user response:

This is indeed a bit tricky to find, but if you check out the last example in the Official Documentation of the Groovy Post Build plugin you will find it:

Example 10 (thanks to Frank Merrow).
Trivial, but hard to find the first time: Write a line to the job's Console > Output:

manager.listener.logger.println("I want to see this line in my job's output");

So just change your println statements to manager.listener.logger.println:

def result = ...
manager.listener.logger.println(result.toString());
manager.listener.logger.println("Sample Groovy Line");
  • Related