我想要通过使用bootRun任务Gradle进行弹簧引导。当Spring Boot启动时,Gradle应该运行Cypress API测试 我有以下build.gradle
plugins { id 'base'}
apply plugin: 'groovy'
apply plugin: 'java-gradle-plugin'
apply from: "$rootDir/gradle/integration-test.gradle"
apply from: "$rootDir/gradle/functional-test.gradle"
apply from: "$rootDir/buildSrc/build.gradle"
repositories {
jcenter()
}
dependencies {
localGroovy()
testCompile ('org.codehaus.groovy:groovy-all:2.5.7')
testCompile('org.spockframework:spock-core:1.3-groovy-2.5')
testImplementation gradleTestKit()
}
allprojects {
task printInfo {
doLast {
println "This is ${project.name}"
}
}
}
task systemtestDevEnv (type: Exec){
workingDir 'frontend'
commandLine 'npm test'
commandLine 'npm start'
workingDir 'functionalsystemtest'
commandLine 'npm run cypress:run'
}
systemtestDevEnv.dependsOn 'backend:runWebServer'
task functionalapitest (type: Exec) {
workingDir 'funcionalapitest'
commandLine 'npm run cypress:run'
}
functionalapitest.dependsOn 'backend:runWebServer'
项目中的目录结构是
JavaProject -功能系统测试 --functionalapitest -后端 - 前端 -buildSrc 当我执行gradlefunctionalapitest时,bootRun已执行,但执行不执行下一步 workingDir'funcionalapitest' 命令行'npm run cypress:run' 我多么生气地询问功能性的API测试,以便在弹簧启动过程开始运行后执行赛普拉斯测试?
任务:backend:bootRun
。 ____ _ __ _ _ _ / \ / ' __ _ ()_ __ __ _ _ \ \ \ \ (()_ |'_ |' | |' / `| \ \ \ \ \ / )| | )| | | | | || ( | | |)))) '| ____ | | |。 | | | | __,| / / / / ======== | _ | ============= | ___ / = / / / _ / :: Spring Boot ::(v2.1.6.RELEASE)
2019-07-25 13:48:20.457信息59589 --- [main] csrRRestfulWebServiceApplication:使用PID 59589在Steins-MacBook-Air.local上启动RestfulWebServiceApplication(/ Users / steinkorsveien / Development / TestWorkSpace / JavaProject / backend / build / classes / java / main由steinkorsveien在/ Users / steinkorsveien / Development / TestWorkSpace / JavaProject / backend中启动) 2019-07-25 13:48:20.469 INFO 59589 --- [main] c.s.r.R.RestfulWebServiceApplication:未设置活动配置文件,回退到默认配置文件:默认 2019-07-25 13:48:23.388信息59589 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer:使用端口初始化的Tomcat:8080(http) 2019-07-25 13:48:23.466信息59589 --- [main] o.apache.catalina.core.StandardService:启动服务[Tomcat] 2019-07-25 13:48:23.467信息59589 --- [main] org.apache.catalina.core.StandardEngine:启动Servlet引擎:[Apache Tomcat / 9.0.21] 2019-07-25 13:48:23.798 INFO 59589 --- [main] o.a.c.c.C. [Tomcat]。[localhost]。[/]:初始化Spring嵌入式WebApplicationContext 2019-07-25 13:48:23.799信息59589 --- [main] o.s.web.context.ContextLoader:根WebApplicationContext:初始化在3188毫秒内完成 2019-07-25 13:48:24.356 INFO 59589 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor:初始化ExecutorService'applicationTaskExecutor' 2019-07-25 13:48:24.977信息59589 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer:Tomcat在端口8080(http)上启动,具有上下文路径'' 2019-07-25 13:48:24.989信息59589 --- [main] c.s.r.R.RestfulWebServiceApplication:在6.301秒内启动RestfulWebServiceApplication(JVM运行7.844) <======= ------> 60%执行[20s]