阿男的小窝

View the Project on GitHub

RESTEasy:只运行testsuite中的某一个测试

首先把legacy-integration-tests这些无关的测试在pom.xml里面给去掉:

$ pwd
/Users/weli/projs/resteasy-upstream/testsuite

下面是pom.xml里面的modules设置:

<modules>
	<module>arquillian-utils</module>
	<!-- <module>unit-tests</module> -->
	<!-- <module>legacy-integration-tests</module> -->
	<module>integration-tests</module>
	<!-- <module>integration-tests-spring</module> -->
</modules>

可以看到,仅保留integration-tests

接下来就是只运行我需要的测试,比如我想运行ParamConverterTest,就执行下面的指令:

$ pwd
/Users/weli/projs/resteasy-upstream/testsuite
$ mvn -q test -Dtest=ParamConverterTest*

以下是执行结果:

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.jboss.resteasy.test.resource.param.ParamConverterTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.032 s - in org.jboss.resteasy.test.resource.param.ParamConverterTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

以上是常用的测试手段。