如何与gradle并行执行JUnit测试,并在我的jvm中具有分片/执行程序标识符?

时间:2019-04-24 15:53:52

标签: java gradle junit

我知道如何与

并行执行测试
tasks.withType(Test) {
    maxParallelForks = 2
}

无论如何,我还需要将执行者ID传递给我的进程,以便我可以隔离有关数据库的运行。

更确切地说,日志显示

Starting process 'Gradle Test Executor 1'. Working directory: /home/mihai.stanescu/work/800/qtalkservice Command: /usr/lib/jvm/java-8-openjdk-amd64/bin/java -Ddebug.proto=true -Djava.security.manager=worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager -Dlog4j.configurationFile=/home/mihai.stanescu/work/800/log4j2.yaml -Dorg.gradle.native=false -Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.Log4j2LogDelegateFactory -javaagent:build/tmp/expandedArchives/org.jacoco.agent-0.8.1.jar_8059ed6e1ab8b88aac5d9097fad847bb/jacocoagent.jar=destfile=build/jacoco/test.exec,append=true,inclnolocationclasses=false,dumponexit=true,output=file,jmx=false -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -ea -cp /home/mihai.stanescu/.gradle/caches/4.9/workerMain/gradle-worker.jar worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 1'
Starting process 'Gradle Test Executor 2'. Working directory: /home/mihai.stanescu/work/800/qtalkservice Command: /usr/lib/jvm/java-8-openjdk-amd64/bin/java -Ddebug.proto=true -Djava.security.manager=worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager -Dlog4j.configurationFile=/home/mihai.stanescu/work/800/log4j2.yaml -Dorg.gradle.native=false -Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.Log4j2LogDelegateFactory -javaagent:build/tmp/expandedArchives/org.jacoco.agent-0.8.1.jar_8059ed6e1ab8b88aac5d9097fad847bb/jacocoagent.jar=destfile=build/jacoco/test.exec,append=true,inclnolocationclasses=false,dumponexit=true,output=file,jmx=false -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -ea -cp /home/mihai.stanescu/.gradle/caches/4.9/workerMain/gradle-worker.jar worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 2'
Successfully started process 'Gradle Test Executor 2'
Successfully started process 'Gradle Test Executor 1'

我想在过程中使用此1和2作为数据库名称的后缀。

0 个答案:

没有答案