Created
June 24, 2020 13:48
-
-
Save solvingj/87851300eb97e5aaab524d3e12eee956 to your computer and use it in GitHub Desktop.
JPU setup error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo.ci.arg | |
import com.lesfurets.jenkins.unit.declarative.DeclarativePipelineTest | |
import org.junit.Before | |
import org.junit.jupiter.api.Test | |
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library | |
import static com.lesfurets.jenkins.unit.global.lib.ProjectSource.projectSource | |
class ConanArgsJPUSpec extends DeclarativePipelineTest { | |
@Override | |
@Before | |
void setUp() throws Exception { | |
super.setUp() | |
def library = library().name('demo_jenkins_library') | |
.defaultVersion('<notNeeded>') | |
.allowOverride(true) | |
.implicit(true) | |
.targetPath('<notNeeded>') | |
.retriever(projectSource()) | |
.build() | |
helper.registerSharedLibrary(library) | |
} | |
@Test | |
void should_execute_without_errors() throws Exception { | |
setUp() // I should not have to do this. super.setup() in setup() should be enough | |
// If i remove, I get error: Helper is not initialized: Call setUp() before tests. | |
File jenkinsfile = new File('test/resources/jenkinsfiles/Jenkinsfile') | |
def script = loadScript(jenkinsfile.path) | |
runScript(script) | |
printCallStack() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, yes, it's JUnit 5. I had no idea there was no
@Before
. That seems to explain the confusion.I just tried and added:
As a hacky workaround and now i don't need to call
setUp()
in all my tests anymore. Thanks!