我正在尝试使用 FIT 创建集成/验收测试。这是文件夹结构:
-src
--main
---fit
----"html files"
---java
----fit
-----"FIT Fixtures files"
----my
-----package
------"business logic files"
这是我的 pom.xml (maven2):
<project ...>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>Test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
...
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>fit-maven-plugin</artifactId>
<version>2.0-beta-3</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>fit-maven-plugin</artifactId>
<version>2.0-beta-3</version>
<executions>
<execution>
<configuration>
<sourceDirectory>src/main/fit</sourceDirectory>
<sourceIncludes>*.html</sourceIncludes>
<outputDirectory>${project.basedir}\target</outputDirectory>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
...
</repositories>
</project>
使用 运行 FIT 测试mvn integration-test -X
时,出现以下错误:
java.lang.IllegalStateException: Fixture failed with counts: 0 对,0 错,0 被忽略,4 个异常
尽管如此,仍会C:\JavaTest\target\customer-bills.html
生成 FIT 输出并包含一条错误消息:
java.lang.RuntimeException: The fixture GivenTheFollowingCustomers was not found.
“GivenTheFollowingCustomers”是 HTML 中的表头:
<table>
<tr>
<td colspan="3" class="title">GivenTheFollowingCustomers</td>
</tr>
...
</table>
我以为系统会一直在寻找名为GivenTheFollowingCustomers
? 为什么它无法找到它?
非常感谢!
更新:
系统现在能够找到第一张桌子的夹具,但只能找到第一张!我遇到了这个问题,因为表头GivenTheFollowingCustomers
不是fit.GivenTheFollowingCustomers
. 尽管如此,对于该 HTML 文件中的所有其他表/夹具,我仍然收到相同的错误。这很奇怪,因为它不依赖于特定的表。例如,如果我将第一个表 ( GivenTheFollowingCustomers
) 移动到第二个位置,它将停止工作,而第一个表开始工作。任何线索..?
Update2:我尝试使用 FIT 库(没有 maven)手动运行测试,它工作正常!此外,其他人写道: http: //osdir.com/ml/java.maven-plugins.mojo.user/2007-07/msg00000.html并没有答案。FIT maven 插件中可能存在的错误..?