有没有办法在maven项目中获得所有测试方法

时间:2015-01-16 20:57:08

标签: maven testing plugins junit testng

我正在开发一个项目,要求我在maven项目下获取所有测试方法。换句话说,我需要获得所有具有@Test注释的方法。我想检查是否有一种方法/插件可以用来获取它。

由于 基兰

2 个答案:

答案 0 :(得分:0)

Have you tried the Maven Surefire Report Plugin?

When I run mvn surefire-report:report an index.html is generated in the /target/surefire-reports/ folder. Clicking on 'Chronological view' or 'Times' links, there is a report which lists every class and every method that was executed by surefire. Looks like it should give you what you need.

答案 1 :(得分:0)

(sig, 181, [], 2)

礼物:

ag --skip-vcs-ignores --xml "<testcase name" | cut -d' ' -f 4,5 | awk '{ print $2 " " $1}' | sed 's/classname="//' | sed 's/" name="/#/' | sed 's/"//'

...等等