@RunWith导致Maven忽略以我自己的跑步者跑步的测试 [英] @RunWith causes Maven to ignore my Test running with my own runner

查看:148
本文介绍了@RunWith导致Maven忽略以我自己的跑步者跑步的测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从仅使用Intellij来管理我的构建系统转移到了Intellij/Maven.当我通过@RunWith(KmlParameterizedRunner.class)用自己的运行程序运行集成测试"MapSimulationTest"时,Intellij正确处理了这种情况,将扫描系统属性"user.dir"指定的目录中的.kml文件,并对每个文件进行测试.

I am moving from using only Intellij to manage my build system to Intellij/Maven. When I run my integration test "MapSimulationTest" with my own runner via @RunWith(KmlParameterizedRunner.class) Intellij correctly handles the situation, the directory specified by the system property "user.dir" is scanned for .kml files and each is tested.

问题似乎是Surefire忽略了@RunWith,有什么建议吗?

The problem seems to be that Surefire ignores @RunWith, any suggestions?

这是Maven日志显示的内容...

Here is what the maven log shows...

--------------------------------------------------- --------测试 -------------------------------------------------- - - - 跑步 com.tqicorp.guru.MapSimulationTest 测试运行:0,失败:0,错误:0, 跳过:0,经过时间:0.061秒

------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.tqicorp.guru.MapSimulationTest Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 sec

推荐答案

我正在将surefire和@RunWith与

I'm using surefire and @RunWith with the Spring test runner, and it is working fine with maven 2.2.1.

要找出问题所在,您可以尝试使用@Test批注而不是旧式的testXXX方法创建一个简单的Junit测试.运行"mvn test",然后查看您的测试是否正在执行.如果是这样,那将排除您的路径中存在旧junit的任何可能性.如果尚未执行,请运行"mvn site",并在依赖项报告中搜索junit,然后检查版本.令人惊讶的是,不需要的版本可以轻易地爬进来!

To track down the problem, you could try creating a simple Junit test using the @Test annotation, rather than the old style testXXX method. Run "mvn test" and see if your test is being executed. If it is, that will rule out any possibility of an old junit in your path. If it's not being executed, then run "mvn site", and search the dependencies report for junit, and check the version. It's amazing how easy unwanted versions can creep in!

这篇关于@RunWith导致Maven忽略以我自己的跑步者跑步的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆