-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented repeat attempts by default #394
Changes from 5 commits
aaccfb4
7a39044
e3ac3d3
c60f9f3
8e7463e
917c205
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,16 @@ public void repeatStatementReturnedWhenRepeatAnnotationFound() throws Exception | |
assertTrue(resultStatement instanceof RepeatStatement); | ||
} | ||
|
||
@Test | ||
public void repeatStatementReturnedWhenRepeatSetRepeatAttemptsByDefault() throws Exception { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't get the Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, it make sense 👍 , changed |
||
Statement baseStatement = new SomeStatement(); | ||
Description description = Description.EMPTY; | ||
|
||
Statement resultStatement = createStatementWithRepeatAttemptsByDefault(baseStatement, description); | ||
|
||
assertTrue(resultStatement instanceof RepeatStatement); | ||
} | ||
|
||
@Test | ||
public void allowFlakyStatementReturnedWhenAllowFlakyAnnotationFound() throws Exception { | ||
Statement baseStatement = new SomeStatement(); | ||
|
@@ -59,13 +69,36 @@ public void allowFlakyStatementReturnedWhenNoAnnotationsFoundButUsesDefault() th | |
Statement baseStatement = new SomeStatement(); | ||
Description description = Description.EMPTY; | ||
|
||
Statement resultStatement = new FlakyStatementBuilder() | ||
Statement resultStatement = createStatementWithAllowFlakyByDefault(baseStatement, description); | ||
|
||
assertTrue(resultStatement instanceof AllowFlakyStatement); | ||
} | ||
|
||
@Test | ||
public void lastStatementReturnedWhenRepeatAttemptsByDefaultAndAllowFlakyStatementUsedAtTheSameTime() throws Exception { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not that important because it's easier to get, but just to be coherent:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed 👍 |
||
Statement baseStatement = new SomeStatement(); | ||
Description description = Description.EMPTY; | ||
|
||
Statement resultStatement = createStatementWithFlakyAndReturn(baseStatement, description); | ||
|
||
assertTrue(resultStatement instanceof RepeatStatement); | ||
} | ||
|
||
private Statement createStatementWithFlakyAndReturn(Statement baseStatement, Description description) { | ||
return new FlakyStatementBuilder() | ||
.setBase(baseStatement) | ||
.setDescription(description) | ||
.allowFlakyAttemptsByDefault(5) | ||
.setRepeatAttemptsByDefault(3) | ||
.build(); | ||
} | ||
|
||
assertTrue(resultStatement instanceof AllowFlakyStatement); | ||
private Statement createStatementWithAllowFlakyByDefault(Statement baseStatement, Description description) { | ||
return new FlakyStatementBuilder() | ||
.setBase(baseStatement) | ||
.setDescription(description) | ||
.allowFlakyAttemptsByDefault(5) | ||
.build(); | ||
} | ||
|
||
//region Shortcut methods | ||
|
@@ -76,6 +109,14 @@ private Statement createStatement(Statement baseStatement, Description descripti | |
.build(); | ||
} | ||
|
||
private Statement createStatementWithRepeatAttemptsByDefault(Statement baseStatement, Description description) { | ||
return new FlakyStatementBuilder() | ||
.setBase(baseStatement) | ||
.setDescription(description) | ||
.setRepeatAttemptsByDefault(3) | ||
.build(); | ||
} | ||
|
||
private Description withAnnotations(Annotation... annotations) { | ||
return Description.createTestDescription(CLASS, TEST, annotations); | ||
} | ||
|
@@ -115,4 +156,4 @@ public void evaluate() throws Throwable { | |
} | ||
} | ||
//endregion | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Repeat] or [Repeat]
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was
[Repeat] or [AllowFlaky]
, fixed!