-
Notifications
You must be signed in to change notification settings - Fork 188
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
feat(baseline): Allow force creating fresh baseline #2124
base: master
Are you sure you want to change the base?
Changes from 11 commits
853cbd9
dc5686f
e986e68
89b9cb6
5c7705d
68d4e39
67db04d
4871f39
36a4ce9
e180534
f1f6cf3
7dd8a89
e44bb01
9ebf7f7
e1b4d14
ca9b354
60d6d41
02193a7
8f39401
938920d
dc0f060
4d5303b
97d5c54
0d9a5e6
b530afa
4f6c3cc
a02f5c9
548d06b
ef6392f
552c9a3
0d62dda
e51eebd
937f26f
d0fa85a
d7ac653
079311a
e87f5bb
4c21604
1202182
0380d09
0ba1d08
0dc89f4
20cab04
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 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -452,7 +452,7 @@ Config file: `"since": { }` | |||||||||||||||
|
||||||||||||||||
Use git information to test only code changes since the given target. Stryker will only report on mutants within the changed code. All other mutants will not have a result. | ||||||||||||||||
|
||||||||||||||||
If you wish to test only changed sources and tests but would like to have a complete mutation report see [with-baseline](#with-baseline-flag-committish). | ||||||||||||||||
If you wish to test only changed sources and tests but would like to have a complete mutation report see [with-baseline](#with-baseline-committish). | ||||||||||||||||
|
||||||||||||||||
Set the diffing target on the command line by passing a committish with the since flag in the format `--since:<committish>`. | ||||||||||||||||
Set the diffing target in the config file by setting the [since target](#sincetarget-committish) option. | ||||||||||||||||
|
@@ -492,33 +492,26 @@ Use [globbing syntax](https://en.wikipedia.org/wiki/Glob_(programming)) for wild | |||||||||||||||
|
||||||||||||||||
## Baseline | ||||||||||||||||
|
||||||||||||||||
### `baseline` <`command`> | ||||||||||||||||
### `with-baseline` <`committish`> | ||||||||||||||||
|
||||||||||||||||
Default: `false` | ||||||||||||||||
Command line: `dotnet stryker baseline` | ||||||||||||||||
Config file: `"baseline": { }` | ||||||||||||||||
Default: `false` | ||||||||||||||||
Command line: `with-baseline feat-2` | ||||||||||||||||
Config file: `"baseline": { }` | ||||||||||||||||
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.
Suggested change
|
||||||||||||||||
|
||||||||||||||||
Enabling `with-baseline` saves the mutation report to a storage location such as the filesystem. The mutation report is loaded at the start of the next mutation run. Any changed source code or unit test results in a reset of the mutants affected by the change. For unchanged mutants the previous result is reused. This feature expands on the [since](#since-flag-committish) feature by providing you with a full report after a partial mutation testrun. | ||||||||||||||||
Enabling `baseline`, alias `with-baseline`, saves the mutation report to a storage location such as the filesystem. The mutation report is loaded at the start of the next mutation run. Any changed source code or unit test results in a reset of the mutants affected by the change. For unchanged mutants the previous result is reused. This feature expands on the [since](#since-flag-committish) feature by providing you with a full report after a partial mutation testrun. The target of the baseline is a `committish` passed as an extra argument. The target determines which committish is used to establish or locate a baseline. | ||||||||||||||||
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. Why does not still need to be a committish? We are trying to move away from git for baseline. |
||||||||||||||||
|
||||||||||||||||
The report name is based on the current branch name or the [project-info.version](#project-infoversion-committish). | ||||||||||||||||
|
||||||||||||||||
*\* The baseline and since features are mutually exclusive. This feature implicitly enables the [since](#since-flag-committish) feature for now.* | ||||||||||||||||
|
||||||||||||||||
### `target` <`string`> | ||||||||||||||||
|
||||||||||||||||
Default: `false` | ||||||||||||||||
Command line: `dotnet stryker baseline --target feat-2` | ||||||||||||||||
Config file: `"baseline": { "target": "feat-2" }` | ||||||||||||||||
|
||||||||||||||||
Set the target on the command line by passing a committish with the baseline target option. | ||||||||||||||||
*\* The baseline and since features are mutually exclusive. This feature implicitly enables the [since](#since-flag-committish) feature for now.* | ||||||||||||||||
|
||||||||||||||||
### `baseline.fallback-version` <`string`> | ||||||||||||||||
|
||||||||||||||||
Default: [since-target](#since-flag-committish) | ||||||||||||||||
Command line: `N/A` | ||||||||||||||||
Config file: `"baseline": { "fallback-version": 'develop' }` | ||||||||||||||||
Default: [since-target](#since-flag-committish) | ||||||||||||||||
Command line: `N/A` | ||||||||||||||||
Config file: `"baseline": { "fallback-version": 'develop' }` | ||||||||||||||||
|
||||||||||||||||
When [with-baseline](#with-baseline-flag-committish) is enabled and Stryker cannot find an existing report for the current branch the fallback version is used. When Stryker is still unable to find a baseline we will do a complete instead of partial testrun. The complete testrun will then be saved as the new baseline for the next mutation testrun. | ||||||||||||||||
When [with-baseline](#with-baseline-committish) is enabled and Stryker cannot find an existing report for the current branch the fallback version is used. When Stryker is still unable to find a baseline we will do a complete instead of partial testrun. The complete testrun will then be saved as the new baseline for the next mutation testrun. | ||||||||||||||||
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.
Suggested change
|
||||||||||||||||
|
||||||||||||||||
**Example**: | ||||||||||||||||
```json | ||||||||||||||||
|
@@ -553,9 +546,9 @@ new baseline saved to: feat-2 | |||||||||||||||
|
||||||||||||||||
Default: `Disk` | ||||||||||||||||
Command line: `N/A` | ||||||||||||||||
Config file: `"baseline": { "provider": 'AzureFileStorage'}` | ||||||||||||||||
Config file: `"baseline": { "provider": 'AzureFileStorage'}` | ||||||||||||||||
|
||||||||||||||||
Sets the storage provider for the baseline used by [with-baseline](#with-baseline-flag-committish). By default this is set to disk, when the dashboard [reporter](#reporter-string) is enabled this is automatically set to Dashboard. | ||||||||||||||||
Sets the storage provider for the baseline used by [with-baseline](#with-baseline-committish). By default this is set to disk, when the dashboard [reporter](#reporter-string) is enabled this is automatically set to Dashboard. | ||||||||||||||||
|
||||||||||||||||
Supported storage providers are: | ||||||||||||||||
|
||||||||||||||||
|
@@ -584,7 +577,7 @@ Providing a subfolder is optional but allowed. In the case of a custom subfolder | |||||||||||||||
### `azure-fileshare-sas` <`string`> | ||||||||||||||||
|
||||||||||||||||
Default: `null` | ||||||||||||||||
Command line: `dotnet stryker baseline --azure-fileshare-sas "se=2022-08-25T14%3A27Z&sp=rwdl&spr=https&sv=2021-06-08&sr=d&sdd=1&sig=XXXXXXXXXXXXX"` | ||||||||||||||||
Command line: `--azure-fileshare-sas "se=2022-08-25T14%3A27Z&sp=rwdl&spr=https&sv=2021-06-08&sr=d&sdd=1&sig=XXXXXXXXXXXXX"` | ||||||||||||||||
Config file: `N/A` | ||||||||||||||||
|
||||||||||||||||
When using the azure file storage [provider](#baselineprovider-string) you must pass credentials for the fileshare to Stryker. | ||||||||||||||||
|
@@ -601,7 +594,7 @@ For more information on how to configure a SAS check the [Azure documentation](h | |||||||||||||||
### `baseline recreate` | ||||||||||||||||
|
||||||||||||||||
Default: `false` | ||||||||||||||||
Command line: `dotnet stryker baseline recreate` | ||||||||||||||||
Command line: `with-baseline main recreate` | ||||||||||||||||
Config file: `N/A` | ||||||||||||||||
|
||||||||||||||||
Sometimes your baseline can get corrupted or out of touch with reality. In that case the baseline can be recreated using this command. This will test all mutations in your project and save the result as the new baseline. | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,8 @@ public void RegisterInitCommand(CommandLineApplication app, IFileSystem fileSyst | |
{ | ||
RegisterCliInputs(initCommandApp); | ||
|
||
initCommandApp.HelpOption(); | ||
|
||
initCommandApp.OnExecute(() => | ||
{ | ||
_console.WriteLine($"Initializing new config file."); | ||
|
@@ -72,10 +74,17 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i | |
{ | ||
app.Command("baseline", baselineCmd => | ||
{ | ||
baselineCmd.AddName("with-baseline"); | ||
RegisterCliInputs(baselineCmd); | ||
|
||
var committishArg = baselineCmd.Argument("committish", "The committish to compare with the current HEAD. This can be a branch, tag or commit id."); | ||
committishArg.IsRequired(true); | ||
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. Are we not using a default target version anymore? |
||
|
||
baselineCmd.HelpOption(); | ||
|
||
baselineCmd.OnExecute(() => | ||
{ | ||
inputs.BaselineTargetInput.SuppliedInput = committishArg.Value; | ||
inputs.BaselineEnabledInput.SuppliedInput = true; | ||
baselineCmd.Description = "Starts a stryker run based on the results of a previous run."; | ||
return strykerCli.StartApp(inputs, args, app, this); | ||
|
@@ -85,8 +94,11 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i | |
{ | ||
RegisterCliInputs(createCmd); | ||
|
||
createCmd.HelpOption(); | ||
|
||
createCmd.OnExecute(() => | ||
{ | ||
inputs.BaselineTargetInput.SuppliedInput = committishArg.Value; | ||
inputs.BaselineEnabledInput.SuppliedInput = true; | ||
createCmd.Description = "Creates a new baseline by doing a full stryker run"; | ||
// Enable recreate | ||
|
@@ -212,7 +224,6 @@ private void PrepareCliOptions(IStrykerInputs inputs) | |
AddCliInput(inputs.MutationLevelInput, "mutation-level", "l", category: InputCategory.Mutation); | ||
AddCliInput(inputs.SinceInput, "since", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); | ||
AddCliInput(inputs.BaselineEnabledInput, "with-baseline", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); | ||
AddCliInput(inputs.BaselineTargetInput, "target", "", argumentHint: "committish", category: InputCategory.Mutation); | ||
// Category: Reporting | ||
AddCliInput(inputs.OpenReportInput, "open-report", "o", CommandOptionType.SingleOrNoValue, argumentHint: "report-type", category: InputCategory.Reporting); | ||
AddCliInput(inputs.ReportersInput, "reporter", "r", optionType: CommandOptionType.MultipleValue, category: InputCategory.Reporting); | ||
|
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.