有没有一种方法可以只跳过Maven中的单个测试? [英] Is there a way to skip only a single test in maven?

查看:128
本文介绍了有没有一种方法可以只跳过Maven中的单个测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在启动mvn install时仅跳过一个测试.

I would like to skip only a single test while launching mvn install.

有没有办法做到这一点?

Is there a way to do that ?

推荐答案

对于junit 4,我想添加一个@Ignore批注.这将对您有用,除非您只想有时忽略测试,或者仅在从Maven运行构建时才忽略它.如果是这样,那么我会问为什么?"

With junit 4, I add an @Ignore annotation when I want to do that. This would work for you, unless you want to only sometimes ignore the test, or only ignore it when the build runs from maven. If this is the case, then I would ask "Why?"

测试应该是一致的,它们应该是可移植的,并且它们应该始终通过.如果特定测试有问题,我会考虑重新编写,将其完全删除或将其移至其他测试套件或项目.

Tests should be consistent, they should be portable, and they should always pass. If a specific test is problematic I would consider re-writing it, removing it entirely, or moving it to a different test suite or project.

这篇关于有没有一种方法可以只跳过Maven中的单个测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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