Reputation: 45
In the middle of upgrading to junit 5, the current issue I'm running into is when running ant. Before we were setting system properties in the junit task which no longer works with junitlauncher.
Setting the sysproperty outside of junitlauncher doesn't seem to work either.
<sysproperty key="server" value="${input.server}"/>
Gets the error
Problem: failed to create task or type sysproperty
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
Java 17, JUnit 4 & 5, Ant 1.10
Upvotes: 2
Views: 73
Reputation: 312086
Instead of setting system properties from the build system, you could make your test more self-contained and set them directly in the test with JUnit Pioneer's @SetSystemProperty
:
@Test
@SetSystemProprty(key = "server", value = "myserver")
public void testSomething() {
// ...
Upvotes: 0