简单的Tmar测试没有运行

时间:2015-12-12 16:34:19

标签: groovy jspresso

我有一个简单的groovy项目,其中我正在尝试运行Tmar测试而不是。 这是我的项目结构和Tmar给出的堆栈跟踪的副本。

Poject structure

测试执行的堆栈跟踪:

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"
    }
}

2 个答案:

答案 0 :(得分:0)

我认为XML应该是这样的

   <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <TMAR>
        <CONFIG>
            <PROJECT name="Tmar sample project"/>
            <LOGO name="tmar-with-name-big.png"/>
            <DESCRIPTION_DIRECTORY name="src/test/resources/tmar/descriptions" type="file"/>
            <WORKING_DIRECTORY name="src/test/resources/tmar/working" type="file"/>
            <RESULT_DIRECTORY name="target/tmar-test-results"/>
            <REPORT_DIRECTORY name="target/tmar-test-report"/>
            <SRC_GOOGLE_GRAPH name="https://www.google.com/jsapi"/>
            <SHORTCUT name="WIKIPEDIA" value="http://en.wikipedia.org/wiki/"/>
        </CONFIG>
    </TMAR>

这是github链接:dropna

您缺少WORKING_DIRECTORY。

答案 1 :(得分:0)

您的Tmar项目没问题, 但是我用它进行了测试,我发现你的pom文件中引用了Tmar和groovy版本2.4.4的问题。 降级到2.3.1,它应该工作