[英]Robolectric - how to disable a unit test?
I have a robolectric unit test that is work in progress. 我有一个正在进行中的robolectric单元测试 。 I want to disable it temporarily pending implementation, but I don't want to comment out the entire test. 我想暂时禁用它,等待实现,但我不想评论整个测试。
How can a robolectric unit test be temporarily disabled without actually removing the test? 如何在不实际取消测试的情况下暂时禁用robolectric单元测试?
The JUnit @Ignore
attribute can be used to temporarily disable a unit test: JUnit @Ignore
属性可用于临时禁用单元测试:
@RunWith(MyRobolectricGradleTestRunner.class)
public class TestAbc123 extends MyTestBase
{
@Ignore // This attribute may be removed once the test is ready
@Test
public void TestAbc123Scenerio1()
{
Ignored tests are shown as an amber disc with horizontal bars: 忽略的测试显示为带有水平条的琥珀色圆盘:
To ignore a Unit test, annotate it with @Ignore
. 要忽略单元测试,请使用@Ignore
对其进行@Ignore
。
You can add an optional comment to record why the test is being ignored: 您可以添加可选注释以记录忽略测试的原因:
@Ignore("Not ready yet")
@Test
public void testToIgnore()
{
// ...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.