-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
74 lines (57 loc) · 2.01 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Pending is an alternative to using @Ignore for bypassing tests that are failing
due to the functionality not being implemented yet.
Pending provides is a JUnit rule and annotation for marking tests as pending.
A pending test is expected to fail. Should the test pass the unexpected success
will be reported.
Mark Tests As Pending with @PendingImplementation
----------------------------------------------------
Add the @PendingImplementation annotation to either a test class or method to
mark tests as pending.
Example:
@PendingImplementation
public class MyTest {
@Rule public MethodRule pendingRule = new PendingRule();
/* Failing test methods */
...
}
public class MyTest {
@Rule public MethodRule pendingRule = new PendingRule();
@PendingImplementation
@Test public void
testMethod() {
/* Failing test */
...
}
}
The @Pending annotation takes an optional default parameter if you want to
record why a test is marked as pending.
Example:
Code:
public class MyTest {
@Rule public MethodRule pendingRule = PendingRule.withOutput();
@PendingImplementation("Work in progress")
@Test public void
testMethod() {
/* Failing test */
...
}
}
Mark Tests As Pending with JUnit @Category
--------------------------------------------
Tests can be marked as pending with JUnit's @Category annotation.
Example:
@Category(PendingCategory.class)
public class MyTest {
@Rule public MethodRule pendingRule = new PendingRule(PendingCategory.class);
/* Failing test methods */
...
}
public class MyTest {
@Rule public MethodRule pendingRule = new PendingRule(PendingCategory.class);
@Category(PendingCategory.class)
@Test public void
testMethod() {
/* Failing test */
...
}
}