In my case, I have a Java Web based in Gradle. In my web project I have files .js which I want to make unit testing using JASMINE. I need execute this test when the command "gradle build" is called.
if is posible, please, share with me very basic project to understand.
Extra: In an environment of continuous integration (like Jenkins Tool) is very important automate unit test.
答案 0 :(得分:0)
注意:我不熟悉Jasmine
首先,我为茉莉花
创建一个sourceSet
sourceSets {
jasmine {
resources {
srcDir "$webAppDirName"
srcDir 'src/test/jasmine'
include '**/*.js'
}
}
}
接下来,我将创建一个执行jasmine的任务
task jasmineTest(type: Exec) {
def outputDir = file("$buildDir/jasmine")
// set the task inputs/outputs for up-to-date checking
inputs.files sourceSets.jasmine
outputs.dir outputDir
// configure the Exec task
executable 'jasmine.exe'
args ['-d', outputDir, '-f', sourceSets.jasmine.output.files.join(',')]
}
然后,将您的任务附加到check
任务
check.dependsOn jasmineTest