Skip to content

Commit

Permalink
Merge branch 'master' into support-dockerfile-agent-declaration-with-…
Browse files Browse the repository at this point in the history
…filename
  • Loading branch information
Zsolt Györffi committed Apr 17, 2023
2 parents ff1060c + 33593e1 commit 2b5d65c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,24 @@ class TestExampleJob extends BasePipelineTest {
void setUp() {
super.setUp()
// Assigns false to a job parameter ENABLE_TEST_STAGE
binding.setVariable('ENABLE_TEST_STAGE', 'false')
addParam('ENABLE_TEST_STAGE', 'false')
// Defines the previous execution status
binding.getVariable('currentBuild').previousBuild = [result: 'UNSTABLE']
}
@Test
void verifyParam() {
assertEquals('false', binding.getVariable('params')['ENABLE_TEST_STAGE'])
}
}
```

The test helper already provides basic variables such as a very simple `currentBuild`
definition. You can redefine them as you wish.

Note that parameters added via `addParam` are immutable, which reflects the same behavior
in Jenkins. Attempting to modify the `params` map in the binding will result in an error.

### Mocking Jenkins Commands

You can register interceptors to mock pipeline methods, including Jenkins commands, which
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import com.lesfurets.gradle.*

plugins {
id "com.jfrog.artifactory" version "4.31.1"
id "com.jfrog.artifactory" version "4.31.9"
id 'groovy'
id 'maven-publish'
id 'java-library'
Expand Down

0 comments on commit 2b5d65c

Please sign in to comment.