Before migration I can set -Darguments in mvn test -D.... build was started with surefire but in Gradle I can't do it
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<includes>
<include>**/RunCucumberIT.java</include>
<release>11</release>
</includes>
<parallel>methods</parallel>
<threadCount>${parallel.count}</threadCount>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-Xmx2048m
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
After migration
dependencies {
compile 'org.apache.maven.plugins:maven-surefire-plugin:2.21.0'
}
test {
ignoreFailures = true
include '**/RunCucumberIT.java'
//option doesn't works
//options {
//parallel = "methods"
//forkCount = 4
}
}
I need to run it in parallel, and also -Darguments=someArgument doesn't work
You need to set the system property in your Gradle task.
example:
task <task_name> {
systemProperty "arguments", System.getProperty("arguments")
}
Now the application can read -Darguments=someArgument
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.