我有一个简单的 groovy 项目,我正在尝试运行一个没有的 Tmar 测试。这是我的项目结构和 Tmar 给出的堆栈跟踪的副本。
以及测试执行的堆栈跟踪:
Start test
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.701 sec <<< FAILURE! - in org.dealus.MowItTest
test(org.dealus.MowItTest) Time elapsed: 0.14 sec <<< ERROR!
java.io.FileNotFoundException: D:\Dev\EclipseMarsWorkspace\mowit\target\tmar-test-results\MowItTest.test
at org.codehaus.groovy.runtime.ResourceGroovyMethods.checkDir(ResourceGroovyMethods.java:1043)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.eachFile(ResourceGroovyMethods.java:1062)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.eachFile(ResourceGroovyMethods.java:1088)
at org.codehaus.groovy.runtime.dgm$936.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.jspresso.contrib.tmar.report.TmarReport.generateSingleReport(TmarReport.groovy:1275)
at org.jspresso.contrib.tmar.report.TmarReport$generateSingleReport.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
at org.jspresso.contrib.tmar.core.TmarBaseJUnitTestNG.getData(TmarBaseJUnitTestNG.groovy:30)
at org.jspresso.contrib.tmar.core.TmarBaseJUnitTestNG$getData.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at org.dealus.MowItTest.test(MowItTest.groovy:12)
Results :
Tests in error:
MowItTest.test:12->TmarBaseJUnitTestNG.getData:30 » FileNotFound D:\Dev\Eclips...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
tmar 测试描述文件:
MowItTest
/each
[ Result ? |
| Test ok |
这是基本代码:
package org.dealus
import org.jspresso.contrib.tmar.core.Tmar4JUnit;
import org.junit.Assert;
import org.junit.Test
class MowItTest extends Tmar4JUnit {
@Test
void test() {
println "Start test"
def testTmar = getData('test')
eachIteration(testTmar) { tmar ->
tmar.result = "Test ok"
}
println "Test complete"
}
}