Skip to content

Commit 2377bc7

Browse files
author
Nitin Gurram
authored
Porting to M130 (#6483)
1 parent ff6f7aa commit 2377bc7

File tree

4 files changed

+95
-42
lines changed

4 files changed

+95
-42
lines changed

Tasks/VsTest/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,6 @@
166166
"loc.messages.OverrideUseVerifiableInstrumentation": "Overriding UseVerifiableInstrumentation field to false in the runsettings file.",
167167
"loc.messages.NoTestResultsDirectoryFound": "Test results directory not found.",
168168
"loc.messages.OnlyWindowsOsSupported": "This task is supported only on Windows agents and cannot be used on other platforms.",
169-
"loc.messages.MultiConfigNotSupportedWithOnDemand": "On demand runs are not supported with Multi-Configuration option. Please use 'None' or 'Multi-agent' parallelism option."
169+
"loc.messages.MultiConfigNotSupportedWithOnDemand": "On demand runs are not supported with Multi-Configuration option. Please use 'None' or 'Multi-agent' parallelism option.",
170+
"loc.messages.disabledRerun": "Disabling the rerun of failed tests as the rerun threshold provided is %s"
170171
}

Tasks/VsTest/task.json

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"version": {
1818
"Major": 2,
1919
"Minor": 3,
20-
"Patch": 21
20+
"Patch": 22
2121
},
2222
"demands": [
2323
"vstest"
@@ -59,6 +59,9 @@
5959
"testAssemblies": "Test assemblies",
6060
"testPlan": "Test plan",
6161
"testRun": "Test run"
62+
},
63+
"properties": {
64+
"EditableOptions": "True"
6265
}
6366
},
6467
{
@@ -84,7 +87,8 @@
8487
"helpMarkDown": "Select a test plan containing test suites with automated test cases.",
8588
"groupName": "testSelection",
8689
"properties": {
87-
"DisableManageLink": "True"
90+
"DisableManageLink": "True",
91+
"EditableOptions": "True"
8892
},
8993
"visibleRule": "testSelector = testPlan"
9094
},
@@ -98,7 +102,8 @@
98102
"groupName": "testSelection",
99103
"properties": {
100104
"MultiSelect": "True",
101-
"DisableManageLink": "True"
105+
"DisableManageLink": "True",
106+
"EditableOptions": "True"
102107
},
103108
"visibleRule": "testSelector = testPlan"
104109
},
@@ -111,7 +116,8 @@
111116
"helpMarkDown": "Select Test Configuration.",
112117
"groupName": "testSelection",
113118
"properties": {
114-
"DisableManageLink": "True"
119+
"DisableManageLink": "True",
120+
"EditableOptions": "True"
115121
},
116122
"visibleRule": "testSelector = testPlan"
117123
},
@@ -203,6 +209,9 @@
203209
"15.0": "Visual Studio 2017",
204210
"14.0": "Visual Studio 2015",
205211
"toolsInstaller": "Installed by Tools Installer"
212+
},
213+
"properties": {
214+
"EditableOptions": "True"
206215
}
207216
},
208217
{
@@ -295,6 +304,9 @@
295304
"basedOnTestCases": "Based on number of tests and agents",
296305
"basedOnExecutionTime": "Based on past running time of tests",
297306
"basedOnAssembly": "Based on test assemblies"
307+
},
308+
"properties": {
309+
"EditableOptions": "True"
298310
}
299311
},
300312
{
@@ -333,6 +345,9 @@
333345
"autoBatchSize": "Automatically determine the batch time",
334346
"customTimeBatchSize": "Specify running time per batch"
335347
},
348+
"properties": {
349+
"EditableOptions": "True"
350+
},
336351
"visibleRule": "distributionBatchType = basedOnExecutionTime"
337352
},
338353
{
@@ -411,6 +426,9 @@
411426
"basedOnTestFailurePercentage": "% failure",
412427
"basedOnTestFailureCount": "# of failed tests"
413428
},
429+
"properties": {
430+
"EditableOptions": "True"
431+
},
414432
"visibleRule": "rerunFailedTests = true"
415433
},
416434
{
@@ -560,6 +578,7 @@
560578
"OverrideUseVerifiableInstrumentation": "Overriding UseVerifiableInstrumentation field to false in the runsettings file.",
561579
"NoTestResultsDirectoryFound": "Test results directory not found.",
562580
"OnlyWindowsOsSupported": "This task is supported only on Windows agents and cannot be used on other platforms.",
563-
"MultiConfigNotSupportedWithOnDemand": "On demand runs are not supported with Multi-Configuration option. Please use 'None' or 'Multi-agent' parallelism option."
581+
"MultiConfigNotSupportedWithOnDemand": "On demand runs are not supported with Multi-Configuration option. Please use 'None' or 'Multi-agent' parallelism option.",
582+
"disabledRerun": "Disabling the rerun of failed tests as the rerun threshold provided is %s"
564583
}
565584
}

Tasks/VsTest/task.loc.json

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"version": {
1818
"Major": 2,
1919
"Minor": 3,
20-
"Patch": 21
20+
"Patch": 22
2121
},
2222
"demands": [
2323
"vstest"
@@ -59,6 +59,9 @@
5959
"testAssemblies": "Test assemblies",
6060
"testPlan": "Test plan",
6161
"testRun": "Test run"
62+
},
63+
"properties": {
64+
"EditableOptions": "True"
6265
}
6366
},
6467
{
@@ -84,7 +87,8 @@
8487
"helpMarkDown": "ms-resource:loc.input.help.testPlan",
8588
"groupName": "testSelection",
8689
"properties": {
87-
"DisableManageLink": "True"
90+
"DisableManageLink": "True",
91+
"EditableOptions": "True"
8892
},
8993
"visibleRule": "testSelector = testPlan"
9094
},
@@ -98,7 +102,8 @@
98102
"groupName": "testSelection",
99103
"properties": {
100104
"MultiSelect": "True",
101-
"DisableManageLink": "True"
105+
"DisableManageLink": "True",
106+
"EditableOptions": "True"
102107
},
103108
"visibleRule": "testSelector = testPlan"
104109
},
@@ -111,7 +116,8 @@
111116
"helpMarkDown": "ms-resource:loc.input.help.testConfiguration",
112117
"groupName": "testSelection",
113118
"properties": {
114-
"DisableManageLink": "True"
119+
"DisableManageLink": "True",
120+
"EditableOptions": "True"
115121
},
116122
"visibleRule": "testSelector = testPlan"
117123
},
@@ -203,6 +209,9 @@
203209
"15.0": "Visual Studio 2017",
204210
"14.0": "Visual Studio 2015",
205211
"toolsInstaller": "Installed by Tools Installer"
212+
},
213+
"properties": {
214+
"EditableOptions": "True"
206215
}
207216
},
208217
{
@@ -295,6 +304,9 @@
295304
"basedOnTestCases": "Based on number of tests and agents",
296305
"basedOnExecutionTime": "Based on past running time of tests",
297306
"basedOnAssembly": "Based on test assemblies"
307+
},
308+
"properties": {
309+
"EditableOptions": "True"
298310
}
299311
},
300312
{
@@ -333,6 +345,9 @@
333345
"autoBatchSize": "Automatically determine the batch time",
334346
"customTimeBatchSize": "Specify running time per batch"
335347
},
348+
"properties": {
349+
"EditableOptions": "True"
350+
},
336351
"visibleRule": "distributionBatchType = basedOnExecutionTime"
337352
},
338353
{
@@ -411,6 +426,9 @@
411426
"basedOnTestFailurePercentage": "% failure",
412427
"basedOnTestFailureCount": "# of failed tests"
413428
},
429+
"properties": {
430+
"EditableOptions": "True"
431+
},
414432
"visibleRule": "rerunFailedTests = true"
415433
},
416434
{
@@ -560,6 +578,7 @@
560578
"OverrideUseVerifiableInstrumentation": "ms-resource:loc.messages.OverrideUseVerifiableInstrumentation",
561579
"NoTestResultsDirectoryFound": "ms-resource:loc.messages.NoTestResultsDirectoryFound",
562580
"OnlyWindowsOsSupported": "ms-resource:loc.messages.OnlyWindowsOsSupported",
563-
"MultiConfigNotSupportedWithOnDemand": "ms-resource:loc.messages.MultiConfigNotSupportedWithOnDemand"
581+
"MultiConfigNotSupportedWithOnDemand": "ms-resource:loc.messages.MultiConfigNotSupportedWithOnDemand",
582+
"disabledRerun": "ms-resource:loc.messages.disabledRerun"
564583
}
565584
}

Tasks/VsTest/taskinputparser.ts

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -177,41 +177,11 @@ function initTestConfigurations(testConfiguration: models.TestConfigurations) {
177177
testConfiguration.testRunTitle = tl.getInput('testRunTitle');
178178

179179
// Rerun information
180-
//TODO close the experience/UI text
181180
testConfiguration.rerunFailedTests = tl.getBoolInput('rerunFailedTests');
182181
console.log(tl.loc('rerunFailedTests', testConfiguration.rerunFailedTests));
183182

184183
if (testConfiguration.rerunFailedTests) {
185-
testConfiguration.rerunType = tl.getInput('rerunType') || 'basedOnTestFailurePercentage';
186-
187-
if (testConfiguration.rerunType === 'basedOnTestFailureCount') {
188-
testConfiguration.rerunFailedTestCasesMaxLimit = 5; //default value in case of error
189-
const rerunFailedTestCasesMaxLimit = parseInt(tl.getInput('rerunFailedTestCasesMaxLimit'));
190-
if (!isNaN(rerunFailedTestCasesMaxLimit) && rerunFailedTestCasesMaxLimit > 0 && rerunFailedTestCasesMaxLimit <= 100) {
191-
testConfiguration.rerunFailedTestCasesMaxLimit = rerunFailedTestCasesMaxLimit;
192-
console.log(tl.loc('rerunFailedTestCasesMaxLimit', testConfiguration.rerunFailedTestCasesMaxLimit));
193-
} else {
194-
tl.warning(tl.loc('invalidRerunFailedTestCasesMaxLimit'));
195-
}
196-
} else {
197-
testConfiguration.rerunFailedThreshold = 30; //default value in case of error
198-
const rerunFailedThreshold = parseInt(tl.getInput('rerunFailedThreshold'));
199-
if (!isNaN(rerunFailedThreshold) && rerunFailedThreshold > 0 && rerunFailedThreshold <= 100) {
200-
testConfiguration.rerunFailedThreshold = rerunFailedThreshold;
201-
console.log(tl.loc('rerunFailedThreshold', testConfiguration.rerunFailedThreshold));
202-
} else {
203-
tl.warning(tl.loc('invalidRerunFailedThreshold'));
204-
}
205-
}
206-
207-
testConfiguration.rerunMaxAttempts = 3; //default values incase of error
208-
const rerunMaxAttempts = parseInt(tl.getInput('rerunMaxAttempts'));
209-
if (!isNaN(rerunMaxAttempts) && rerunMaxAttempts > 0 && rerunMaxAttempts <= 10) {
210-
testConfiguration.rerunMaxAttempts = rerunMaxAttempts;
211-
console.log(tl.loc('rerunMaxAttempts', testConfiguration.rerunMaxAttempts));
212-
} else {
213-
tl.warning(tl.loc('invalidRerunMaxAttempts'));
214-
}
184+
parseRerunConfiguration();
215185
}
216186

217187
testConfiguration.vsTestLocationMethod = tl.getInput('vstestLocationMethod');
@@ -268,6 +238,50 @@ function initTestConfigurations(testConfiguration: models.TestConfigurations) {
268238

269239
// Get proxy details
270240
testConfiguration.proxyConfiguration = getProxyConfiguration();
241+
242+
function parseRerunConfiguration() {
243+
testConfiguration.rerunType = tl.getInput('rerunType') || 'basedOnTestFailurePercentage';
244+
245+
if (testConfiguration.rerunType === 'basedOnTestFailureCount') {
246+
testConfiguration.rerunFailedTestCasesMaxLimit = 5; //default value in case of error
247+
const rerunFailedTestCasesMaxLimit = parseInt(tl.getInput('rerunFailedTestCasesMaxLimit'));
248+
if (!isNaN(rerunFailedTestCasesMaxLimit) && rerunFailedTestCasesMaxLimit > 0 && rerunFailedTestCasesMaxLimit <= 100) {
249+
testConfiguration.rerunFailedTestCasesMaxLimit = rerunFailedTestCasesMaxLimit;
250+
console.log(tl.loc('rerunFailedTestCasesMaxLimit', testConfiguration.rerunFailedTestCasesMaxLimit));
251+
} else {
252+
if (rerunFailedTestCasesMaxLimit === 0) {
253+
tl.warning(tl.loc('disabledRerun', rerunFailedTestCasesMaxLimit));
254+
testConfiguration.rerunFailedTests = false;
255+
return;
256+
} else {
257+
tl.warning(tl.loc('invalidRerunFailedTestCasesMaxLimit'));
258+
}
259+
}
260+
} else {
261+
testConfiguration.rerunFailedThreshold = 30; //default value in case of error
262+
const rerunFailedThreshold = parseInt(tl.getInput('rerunFailedThreshold'));
263+
if (!isNaN(rerunFailedThreshold) && rerunFailedThreshold > 0 && rerunFailedThreshold <= 100) {
264+
testConfiguration.rerunFailedThreshold = rerunFailedThreshold;
265+
console.log(tl.loc('rerunFailedThreshold', testConfiguration.rerunFailedThreshold));
266+
} else {
267+
if (rerunFailedThreshold === 0) {
268+
tl.warning(tl.loc('disabledRerun', rerunFailedThreshold));
269+
testConfiguration.rerunFailedTests = false;
270+
return;
271+
} else {
272+
tl.warning(tl.loc('invalidRerunFailedThreshold'));
273+
}
274+
}
275+
}
276+
testConfiguration.rerunMaxAttempts = 3; //default values incase of error
277+
const rerunMaxAttempts = parseInt(tl.getInput('rerunMaxAttempts'));
278+
if (!isNaN(rerunMaxAttempts) && rerunMaxAttempts > 0 && rerunMaxAttempts <= 10) {
279+
testConfiguration.rerunMaxAttempts = rerunMaxAttempts;
280+
console.log(tl.loc('rerunMaxAttempts', testConfiguration.rerunMaxAttempts));
281+
} else {
282+
tl.warning(tl.loc('invalidRerunMaxAttempts'));
283+
}
284+
}
271285
}
272286

273287
function getProxyConfiguration(): models.ProxyConfiguration {

0 commit comments

Comments
 (0)