-
Notifications
You must be signed in to change notification settings - Fork 3
/
TestCase1.groovy
39 lines (32 loc) · 1.15 KB
/
TestCase1.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.example
import org.junit.Before
import org.junit.Test
import com.lesfurets.jenkins.unit.BasePipelineTest
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.LocalSource.localSource
class TestCase1 extends BasePipelineTest {
@Override
@Before
void setUp() throws Exception {
// TODO: Find a better way of getting project root dir
String dirPath = new File( System.getProperty("user.dir") )
.getAbsoluteFile()
.getParentFile()
.getAbsolutePath()
def library = library()
.name('jenkinslib-example')
.allowOverride(true)
.implicit(false)
.targetPath(dirPath)
.retriever(localSource(dirPath))
.build()
helper.registerSharedLibrary(library)
super.setUp()
}
@Test
void should_run_example_pipeline_without_errors() throws Exception {
def script = loadScript("test\\resources\\pipelines\\example1.pipeline")
script.execute()
printCallStack()
}
}