Skip to content

Commit

Permalink
Added support for editable option for picklist type. Disable Rerun if…
Browse files Browse the repository at this point in the history
… threshold is zero (#6482)
  • Loading branch information
Nitin Gurram authored Feb 21, 2018
1 parent fc90866 commit 79d6b86
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,6 @@
"loc.messages.OverrideUseVerifiableInstrumentation": "Overriding UseVerifiableInstrumentation field to false in the runsettings file.",
"loc.messages.NoTestResultsDirectoryFound": "Test results directory not found.",
"loc.messages.OnlyWindowsOsSupported": "This task is supported only on Windows agents and cannot be used on other platforms.",
"loc.messages.MultiConfigNotSupportedWithOnDemand": "On demand runs are not supported with Multi-Configuration option. Please use 'None' or 'Multi-agent' parallelism option."
"loc.messages.MultiConfigNotSupportedWithOnDemand": "On demand runs are not supported with Multi-Configuration option. Please use 'None' or 'Multi-agent' parallelism option.",
"loc.messages.disabledRerun": "Disabling the rerun of failed tests as the rerun threshold provided is %s"
}
29 changes: 24 additions & 5 deletions Tasks/VsTest/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 2,
"Minor": 3,
"Patch": 25
"Patch": 26
},
"demands": [
"vstest"
Expand Down Expand Up @@ -59,6 +59,9 @@
"testAssemblies": "Test assemblies",
"testPlan": "Test plan",
"testRun": "Test run"
},
"properties": {
"EditableOptions": "True"
}
},
{
Expand All @@ -84,7 +87,8 @@
"helpMarkDown": "Select a test plan containing test suites with automated test cases.",
"groupName": "testSelection",
"properties": {
"DisableManageLink": "True"
"DisableManageLink": "True",
"EditableOptions": "True"
},
"visibleRule": "testSelector = testPlan"
},
Expand All @@ -98,7 +102,8 @@
"groupName": "testSelection",
"properties": {
"MultiSelect": "True",
"DisableManageLink": "True"
"DisableManageLink": "True",
"EditableOptions": "True"
},
"visibleRule": "testSelector = testPlan"
},
Expand All @@ -111,7 +116,8 @@
"helpMarkDown": "Select Test Configuration.",
"groupName": "testSelection",
"properties": {
"DisableManageLink": "True"
"DisableManageLink": "True",
"EditableOptions": "True"
},
"visibleRule": "testSelector = testPlan"
},
Expand Down Expand Up @@ -203,6 +209,9 @@
"15.0": "Visual Studio 2017",
"14.0": "Visual Studio 2015",
"toolsInstaller": "Installed by Tools Installer"
},
"properties": {
"EditableOptions": "True"
}
},
{
Expand Down Expand Up @@ -295,6 +304,9 @@
"basedOnTestCases": "Based on number of tests and agents",
"basedOnExecutionTime": "Based on past running time of tests",
"basedOnAssembly": "Based on test assemblies"
},
"properties": {
"EditableOptions": "True"
}
},
{
Expand Down Expand Up @@ -333,6 +345,9 @@
"autoBatchSize": "Automatically determine the batch time",
"customTimeBatchSize": "Specify running time per batch"
},
"properties": {
"EditableOptions": "True"
},
"visibleRule": "distributionBatchType = basedOnExecutionTime"
},
{
Expand Down Expand Up @@ -411,6 +426,9 @@
"basedOnTestFailurePercentage": "% failure",
"basedOnTestFailureCount": "# of failed tests"
},
"properties": {
"EditableOptions": "True"
},
"visibleRule": "rerunFailedTests = true"
},
{
Expand Down Expand Up @@ -560,6 +578,7 @@
"OverrideUseVerifiableInstrumentation": "Overriding UseVerifiableInstrumentation field to false in the runsettings file.",
"NoTestResultsDirectoryFound": "Test results directory not found.",
"OnlyWindowsOsSupported": "This task is supported only on Windows agents and cannot be used on other platforms.",
"MultiConfigNotSupportedWithOnDemand": "On demand runs are not supported with Multi-Configuration option. Please use 'None' or 'Multi-agent' parallelism option."
"MultiConfigNotSupportedWithOnDemand": "On demand runs are not supported with Multi-Configuration option. Please use 'None' or 'Multi-agent' parallelism option.",
"disabledRerun": "Disabling the rerun of failed tests as the rerun threshold provided is %s"
}
}
29 changes: 24 additions & 5 deletions Tasks/VsTest/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 2,
"Minor": 3,
"Patch": 25
"Patch": 26
},
"demands": [
"vstest"
Expand Down Expand Up @@ -59,6 +59,9 @@
"testAssemblies": "Test assemblies",
"testPlan": "Test plan",
"testRun": "Test run"
},
"properties": {
"EditableOptions": "True"
}
},
{
Expand All @@ -84,7 +87,8 @@
"helpMarkDown": "ms-resource:loc.input.help.testPlan",
"groupName": "testSelection",
"properties": {
"DisableManageLink": "True"
"DisableManageLink": "True",
"EditableOptions": "True"
},
"visibleRule": "testSelector = testPlan"
},
Expand All @@ -98,7 +102,8 @@
"groupName": "testSelection",
"properties": {
"MultiSelect": "True",
"DisableManageLink": "True"
"DisableManageLink": "True",
"EditableOptions": "True"
},
"visibleRule": "testSelector = testPlan"
},
Expand All @@ -111,7 +116,8 @@
"helpMarkDown": "ms-resource:loc.input.help.testConfiguration",
"groupName": "testSelection",
"properties": {
"DisableManageLink": "True"
"DisableManageLink": "True",
"EditableOptions": "True"
},
"visibleRule": "testSelector = testPlan"
},
Expand Down Expand Up @@ -203,6 +209,9 @@
"15.0": "Visual Studio 2017",
"14.0": "Visual Studio 2015",
"toolsInstaller": "Installed by Tools Installer"
},
"properties": {
"EditableOptions": "True"
}
},
{
Expand Down Expand Up @@ -295,6 +304,9 @@
"basedOnTestCases": "Based on number of tests and agents",
"basedOnExecutionTime": "Based on past running time of tests",
"basedOnAssembly": "Based on test assemblies"
},
"properties": {
"EditableOptions": "True"
}
},
{
Expand Down Expand Up @@ -333,6 +345,9 @@
"autoBatchSize": "Automatically determine the batch time",
"customTimeBatchSize": "Specify running time per batch"
},
"properties": {
"EditableOptions": "True"
},
"visibleRule": "distributionBatchType = basedOnExecutionTime"
},
{
Expand Down Expand Up @@ -411,6 +426,9 @@
"basedOnTestFailurePercentage": "% failure",
"basedOnTestFailureCount": "# of failed tests"
},
"properties": {
"EditableOptions": "True"
},
"visibleRule": "rerunFailedTests = true"
},
{
Expand Down Expand Up @@ -560,6 +578,7 @@
"OverrideUseVerifiableInstrumentation": "ms-resource:loc.messages.OverrideUseVerifiableInstrumentation",
"NoTestResultsDirectoryFound": "ms-resource:loc.messages.NoTestResultsDirectoryFound",
"OnlyWindowsOsSupported": "ms-resource:loc.messages.OnlyWindowsOsSupported",
"MultiConfigNotSupportedWithOnDemand": "ms-resource:loc.messages.MultiConfigNotSupportedWithOnDemand"
"MultiConfigNotSupportedWithOnDemand": "ms-resource:loc.messages.MultiConfigNotSupportedWithOnDemand",
"disabledRerun": "ms-resource:loc.messages.disabledRerun"
}
}
76 changes: 45 additions & 31 deletions Tasks/VsTest/taskinputparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,41 +177,11 @@ function initTestConfigurations(testConfiguration: models.TestConfigurations) {
testConfiguration.testRunTitle = tl.getInput('testRunTitle');

// Rerun information
//TODO close the experience/UI text
testConfiguration.rerunFailedTests = tl.getBoolInput('rerunFailedTests');
console.log(tl.loc('rerunFailedTests', testConfiguration.rerunFailedTests));

if (testConfiguration.rerunFailedTests) {
testConfiguration.rerunType = tl.getInput('rerunType') || 'basedOnTestFailurePercentage';

if (testConfiguration.rerunType === 'basedOnTestFailureCount') {
testConfiguration.rerunFailedTestCasesMaxLimit = 5; //default value in case of error
const rerunFailedTestCasesMaxLimit = parseInt(tl.getInput('rerunFailedTestCasesMaxLimit'));
if (!isNaN(rerunFailedTestCasesMaxLimit) && rerunFailedTestCasesMaxLimit > 0 && rerunFailedTestCasesMaxLimit <= 100) {
testConfiguration.rerunFailedTestCasesMaxLimit = rerunFailedTestCasesMaxLimit;
console.log(tl.loc('rerunFailedTestCasesMaxLimit', testConfiguration.rerunFailedTestCasesMaxLimit));
} else {
tl.warning(tl.loc('invalidRerunFailedTestCasesMaxLimit'));
}
} else {
testConfiguration.rerunFailedThreshold = 30; //default value in case of error
const rerunFailedThreshold = parseInt(tl.getInput('rerunFailedThreshold'));
if (!isNaN(rerunFailedThreshold) && rerunFailedThreshold > 0 && rerunFailedThreshold <= 100) {
testConfiguration.rerunFailedThreshold = rerunFailedThreshold;
console.log(tl.loc('rerunFailedThreshold', testConfiguration.rerunFailedThreshold));
} else {
tl.warning(tl.loc('invalidRerunFailedThreshold'));
}
}

testConfiguration.rerunMaxAttempts = 3; //default values incase of error
const rerunMaxAttempts = parseInt(tl.getInput('rerunMaxAttempts'));
if (!isNaN(rerunMaxAttempts) && rerunMaxAttempts > 0 && rerunMaxAttempts <= 10) {
testConfiguration.rerunMaxAttempts = rerunMaxAttempts;
console.log(tl.loc('rerunMaxAttempts', testConfiguration.rerunMaxAttempts));
} else {
tl.warning(tl.loc('invalidRerunMaxAttempts'));
}
parseRerunConfiguration();
}

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

// Get proxy details
testConfiguration.proxyConfiguration = getProxyConfiguration();

function parseRerunConfiguration() {
testConfiguration.rerunType = tl.getInput('rerunType') || 'basedOnTestFailurePercentage';

if (testConfiguration.rerunType === 'basedOnTestFailureCount') {
testConfiguration.rerunFailedTestCasesMaxLimit = 5; //default value in case of error
const rerunFailedTestCasesMaxLimit = parseInt(tl.getInput('rerunFailedTestCasesMaxLimit'));
if (!isNaN(rerunFailedTestCasesMaxLimit) && rerunFailedTestCasesMaxLimit > 0 && rerunFailedTestCasesMaxLimit <= 100) {
testConfiguration.rerunFailedTestCasesMaxLimit = rerunFailedTestCasesMaxLimit;
console.log(tl.loc('rerunFailedTestCasesMaxLimit', testConfiguration.rerunFailedTestCasesMaxLimit));
} else {
if (rerunFailedTestCasesMaxLimit === 0) {
tl.warning(tl.loc('disabledRerun', rerunFailedTestCasesMaxLimit));
testConfiguration.rerunFailedTests = false;
return;
} else {
tl.warning(tl.loc('invalidRerunFailedTestCasesMaxLimit'));
}
}
} else {
testConfiguration.rerunFailedThreshold = 30; //default value in case of error
const rerunFailedThreshold = parseInt(tl.getInput('rerunFailedThreshold'));
if (!isNaN(rerunFailedThreshold) && rerunFailedThreshold > 0 && rerunFailedThreshold <= 100) {
testConfiguration.rerunFailedThreshold = rerunFailedThreshold;
console.log(tl.loc('rerunFailedThreshold', testConfiguration.rerunFailedThreshold));
} else {
if (rerunFailedThreshold === 0) {
tl.warning(tl.loc('disabledRerun', rerunFailedThreshold));
testConfiguration.rerunFailedTests = false;
return;
} else {
tl.warning(tl.loc('invalidRerunFailedThreshold'));
}
}
}
testConfiguration.rerunMaxAttempts = 3; //default values incase of error
const rerunMaxAttempts = parseInt(tl.getInput('rerunMaxAttempts'));
if (!isNaN(rerunMaxAttempts) && rerunMaxAttempts > 0 && rerunMaxAttempts <= 10) {
testConfiguration.rerunMaxAttempts = rerunMaxAttempts;
console.log(tl.loc('rerunMaxAttempts', testConfiguration.rerunMaxAttempts));
} else {
tl.warning(tl.loc('invalidRerunMaxAttempts'));
}
}
}

function getProxyConfiguration(): models.ProxyConfiguration {
Expand Down

0 comments on commit 79d6b86

Please sign in to comment.