-
Notifications
You must be signed in to change notification settings - Fork 187
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
chore: Add wrapper for testrunners #3148
Draft
richardwerkman
wants to merge
14
commits into
master
Choose a base branch
from
3094_mstest_runner
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fec17d0
init
3ad88fe
Add abstractions to vstest
5bcc176
Fix
dfc7a1f
Further add interfaces
cf5d04f
Fix compile errors
a623774
Fix compile errors
765a692
.
65b76d7
merge
3795997
merged master
120e3f1
Extracting vstest into its own project
65f09d6
merged master
bf9229f
fix compilation errors
75493c0
Fix tests (still 3 failing)
6b83b45
Fix two more tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,22 +1,21 @@ | ||
using Stryker.Abstractions.TestRunners; | ||
using Stryker.Abstractions; | ||
using Stryker.Abstractions.Testing; | ||
|
||
namespace Stryker.Abstractions.Mutants; | ||
namespace Stryker.Abstractions; | ||
|
||
public interface IMutant : IReadOnlyMutant | ||
{ | ||
new int Id { get; set; } | ||
new Mutation Mutation { get; set; } | ||
new MutantStatus ResultStatus { get; set; } | ||
new string ResultStatusReason { get; set; } | ||
new ITestGuids CoveringTests { get; set; } | ||
new ITestGuids KillingTests { get; set; } | ||
new ITestGuids AssessingTests { get; set; } | ||
new ITestIdentifiers CoveringTests { get; set; } | ||
new ITestIdentifiers KillingTests { get; set; } | ||
new ITestIdentifiers AssessingTests { get; set; } | ||
new bool CountForStats { get; } | ||
new bool IsStaticValue { get; set; } | ||
|
||
string DisplayName { get; } | ||
bool MustBeTestedInIsolation { get; set; } | ||
|
||
void AnalyzeTestRun(ITestGuids failedTests, ITestGuids resultRanTests, ITestGuids timedOutTests, bool sessionTimedOut); | ||
void AnalyzeTestRun(ITestIdentifiers failedTests, ITestIdentifiers resultRanTests, ITestIdentifiers timedOutTests, bool sessionTimedOut); | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Stryker.Abstractions.Mutants; | ||
namespace Stryker.Abstractions; | ||
|
||
public enum MutantStatus | ||
{ | ||
|
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 @@ | ||
namespace Stryker.Abstractions.Mutators; | ||
namespace Stryker.Abstractions; | ||
|
||
public enum MutationLevel | ||
{ | ||
|
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
1 change: 0 additions & 1 deletion
1
src/Stryker.Abstractions/ProjectComponents/IProjectComponent.cs
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,9 @@ | ||
namespace Stryker.Abstractions.Testing; | ||
|
||
public enum CoverageConfidence | ||
{ | ||
Exact, | ||
Normal, | ||
Dubious, | ||
UnexpectedCase | ||
} |
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,13 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface ICoverageRunResult | ||
{ | ||
Identifier TestId { get; } | ||
Dictionary<int, MutationTestingRequirements> MutationFlags { get; } | ||
IReadOnlyCollection<int> MutationsCovered { get; } | ||
MutationTestingRequirements this[int mutation] { get; } | ||
CoverageConfidence Confidence { get; } | ||
void Merge(ICoverageRunResult coverageRunResult); | ||
} |
24 changes: 24 additions & 0 deletions
24
src/Stryker.Abstractions/Testing/IFrameworkTestDescription.cs
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,24 @@ | ||
using System; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface IFrameworkTestDescription | ||
{ | ||
TestFrameworks Framework { get; } | ||
|
||
ITestDescription Description { get; } | ||
|
||
TimeSpan InitialRunTime { get; } | ||
|
||
Identifier Id { get; } | ||
|
||
int NbSubCases { get; } | ||
|
||
ITestCase Case { get; } | ||
|
||
void RegisterInitialTestResult(ITestResult result); | ||
|
||
void AddSubCase(); | ||
|
||
void ClearInitialResult(); | ||
} |
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,20 @@ | ||
using System; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface ITestCase | ||
{ | ||
Identifier Id { get; } | ||
|
||
string Name { get; } | ||
|
||
string Source { get; } | ||
|
||
string CodeFilePath { get; } | ||
|
||
string FullyQualifiedName { get; } | ||
|
||
Uri Uri { get; } | ||
|
||
int LineNumber { get; } | ||
} |
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,8 @@ | ||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface ITestDescription | ||
{ | ||
Identifier Id { get; } | ||
string Name { get; } | ||
string TestFilePath { get; } | ||
} |
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,17 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface ITestIdentifiers | ||
{ | ||
IEnumerable<Identifier> GetIdentifiers(); | ||
int Count { get; } | ||
bool IsEmpty { get; } | ||
bool IsEveryTest { get; } | ||
ITestIdentifiers Merge(ITestIdentifiers other); | ||
bool Contains(Identifier testId); | ||
bool ContainsAny(ITestIdentifiers other); | ||
bool IsIncludedIn(ITestIdentifiers other); | ||
ITestIdentifiers Intersect(ITestIdentifiers other); | ||
ITestIdentifiers Excluding(ITestIdentifiers testsToSkip); | ||
} |
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,8 @@ | ||
using System; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface ITestResult | ||
{ | ||
TimeSpan Duration { get; } | ||
} |
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,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface ITestRunResult | ||
{ | ||
TimeSpan Duration { get; } | ||
ITestIdentifiers ExecutedTests { get; } | ||
ITestIdentifiers FailingTests { get; } | ||
IEnumerable<string> Messages { get; } | ||
string ResultMessage { get; } | ||
bool SessionTimedOut { get; } | ||
ITestIdentifiers TimedOutTests { get; } | ||
IEnumerable<IFrameworkTestDescription> TestDescriptions { get; } | ||
} |
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,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Stryker.Abstractions; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface ITestRunner : IDisposable | ||
{ | ||
public delegate bool TestUpdateHandler(IReadOnlyList<IMutant> testedMutants, | ||
ITestIdentifiers failedTests, | ||
ITestIdentifiers ranTests, | ||
ITestIdentifiers timedOutTests); | ||
|
||
bool DiscoverTests(string assembly); | ||
|
||
ITestSet GetTests(IProjectAndTests project); | ||
|
||
ITestRunResult InitialTest(IProjectAndTests project); | ||
|
||
IEnumerable<ICoverageRunResult> CaptureCoverage(IProjectAndTests project); | ||
|
||
ITestRunResult TestMultipleMutants(IProjectAndTests project, ITimeoutValueCalculator timeoutCalc, IReadOnlyList<IMutant> mutants, TestUpdateHandler update); | ||
} |
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,12 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public interface ITestSet | ||
{ | ||
int Count { get; } | ||
ITestDescription this[Identifier id] { get; } | ||
void RegisterTests(IEnumerable<ITestDescription> tests); | ||
void RegisterTest(ITestDescription test); | ||
IEnumerable<ITestDescription> Extract(IEnumerable<Identifier> ids); | ||
} |
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,32 @@ | ||
using System; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
public class Identifier : IEquatable<Identifier> | ||
{ | ||
private readonly string _identifier; | ||
|
||
private Identifier(string identifier) => _identifier = identifier; | ||
|
||
public static Identifier Create(string identifier) => new(identifier); | ||
|
||
public static Identifier Create(Guid guid) => new(guid.ToString()); | ||
|
||
public Guid ToGuid() | ||
{ | ||
var isGuid = Guid.TryParse(_identifier, out var guid); | ||
return isGuid ? guid : Guid.Empty; | ||
} | ||
|
||
public override int GetHashCode() => _identifier.GetHashCode(); | ||
|
||
public override string ToString() => _identifier; | ||
|
||
public override bool Equals(object obj) => obj is Identifier identifier && Equals(identifier); | ||
|
||
public bool Equals(Identifier other) => _identifier == other?._identifier; | ||
|
||
public static bool operator ==(Identifier left, Identifier right) => Equals(left, right); | ||
|
||
public static bool operator !=(Identifier left, Identifier right) => !Equals(left, right); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Stryker.Abstractions/Testing/MutationTestingRequirements.cs
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,19 @@ | ||
using System; | ||
|
||
namespace Stryker.Abstractions.Testing; | ||
|
||
[Flags] | ||
public enum MutationTestingRequirements | ||
{ | ||
None = 0, | ||
// mutation is static or executed inside à static context | ||
Static = 1, | ||
// mutation is covered outside test (before or after) | ||
CoveredOutsideTest = 2, | ||
// mutation needs to be activated ASAP when tested | ||
NeedEarlyActivation = 4, | ||
// mutation needs to be run in 'all tests' mode | ||
AgainstAllTests = 8, | ||
// not covered | ||
NotCovered = 256 | ||
} |
2 changes: 1 addition & 1 deletion
2
...tryker.Core/TestRunners/TestFrameworks.cs → ...er.Abstractions/Testing/TestFrameworks.cs
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
None of these changes are necessary for the wrapping