Testing Pipeline Shared Library

34 views
Skip to first unread message

raja.nasrallah

unread,
Apr 27, 2017, 3:08:57 AM4/27/17
to Jenkins Users

Hi,

 

I'm looking on a way to have a unit test for my pipeline shared library.

 

I thought to try the approach of dsl code testing which is using gradle build and the Jenkins harness test framework. I managed to setup project and write the first unit test for my library, but I faced a problem that after executing sh or bat step the library function exit after executing step.

 

To reproduce the issue I've just created a sample library which has a foo() function that using sh or bat and echo 'first' and 'two' but when you run the build it failed because two is not printed into the console long

 

Here is the details for the sample project:

   https://github.com/rajanasrallah/test_pipeline_library

 

To build:

   gradle test

 

 

Kind regards,

Raja Nasrallah

Reply all
Reply to author
Forward
0 new messages