-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from JoshKeegan/retryFeatures
New feature: ability to retry features
- Loading branch information
Showing
23 changed files
with
413 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
VERSION=1.7.0# | ||
VERSION=1.8.0# | ||
|
||
clean: | ||
rm -r ../artefacts || true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using AutoFixture; | ||
using FluentAssertions; | ||
using xRetry; | ||
using Xunit; | ||
|
||
namespace UnitTests | ||
{ | ||
public class RetryTheoryAttributeTests | ||
{ | ||
[Fact] | ||
public void Ctor_Empty_NoSkipOnExceptions() | ||
{ | ||
// Arrange & Act | ||
RetryTheoryAttribute attr = new RetryTheoryAttribute(); | ||
|
||
// Assert | ||
attr.SkipOnExceptions.Should().BeEmpty(); | ||
} | ||
|
||
[Fact] | ||
public void SkipOnExceptionsCtor_Exceptions_ShouldSave() | ||
{ | ||
// Arrange | ||
Type[] expected = new[] | ||
{ | ||
typeof(ArgumentException), | ||
typeof(ArgumentNullException) | ||
}; | ||
|
||
// Act | ||
RetryTheoryAttribute attr = new RetryTheoryAttribute(expected); | ||
|
||
// Assert | ||
attr.SkipOnExceptions.Should().BeEquivalentTo(expected); | ||
} | ||
|
||
[Fact] | ||
public void FullCtr_Exceptions_ShouldSave() | ||
{ | ||
// Arrange | ||
Fixture fixture = new Fixture(); | ||
Type[] expected = new[] | ||
{ | ||
typeof(ArgumentException), | ||
typeof(ArgumentNullException) | ||
}; | ||
|
||
// Act | ||
RetryTheoryAttribute attr = new RetryTheoryAttribute(fixture.Create<int>(), fixture.Create<int>(), expected); | ||
|
||
// Assert | ||
attr.SkipOnExceptions.Should().BeEquivalentTo(expected); | ||
} | ||
|
||
[Fact] | ||
public void Ctor_NonExceptionTypes_ShouldThrow() => | ||
Assert.Throws<ArgumentException>(() => new RetryTheoryAttribute(typeof(RetryFactAttributeTests))); | ||
|
||
[Theory] | ||
[InlineData(0)] | ||
[InlineData(-1)] | ||
[InlineData(-1337)] | ||
public void Ctor_LessThanOneMaxRetries_ShouldThrow(int maxRetries) => | ||
Assert.Throws<ArgumentOutOfRangeException>(() => new RetryTheoryAttribute(maxRetries)); | ||
|
||
[Theory] | ||
[InlineData(-1)] | ||
[InlineData(-1337)] | ||
public void Ctor_NegativeDelayBetweenRetries_ShouldThrow(int delayBetweenRetriesMs) => | ||
Assert.Throws<ArgumentOutOfRangeException>(() => new RetryTheoryAttribute(delayBetweenRetriesMs: delayBetweenRetriesMs)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
test/UnitTests/SpecFlow/Features/RetryFeature/IgnoredRetryFeature.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@retry @ignore | ||
Feature: Ignored Retryable Feature | ||
In order to temorarily disable retryable features | ||
As a QA engineer | ||
I want to be able to ignore entire features marked for retries | ||
|
||
Scenario: Test is ignored | ||
Then fail because this test should have been skipped | ||
|
||
@retry | ||
Scenario: Explicit retry test is ignored | ||
Then fail because this test should have been skipped | ||
|
||
Scenario Outline: Scenario outline test is ignored | ||
Then fail because this test should have been skipped | ||
Examples: | ||
| n | | ||
| 1 | | ||
| 2 | | ||
|
||
@retry | ||
Scenario Outline: Explicit retry scenario outline test is ignored | ||
Then fail because this test should have been skipped | ||
Examples: | ||
| n | | ||
| 1 | | ||
| 2 | |
Oops, something went wrong.