Skip to content
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

Adding results directory UI option in vstest task #11789

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"loc.input.help.tcmTestRun": "Test run based selection is used when triggering automated test runs from the test hub. This option cannot be used for running tests in the CI/CD pipeline.",
"loc.input.label.searchFolder": "Search folder",
"loc.input.help.searchFolder": "Folder to search for the test assemblies.",
"loc.input.label.resultsDirectory": "Test results directory",
vagisha-nidhi marked this conversation as resolved.
Show resolved Hide resolved
"loc.input.help.resultsDirectory": "Folder to store test results. Please make sure to clean up the the results directory before running tests to remove stale results.",
"loc.input.label.testFiltercriteria": "Test filter criteria",
"loc.input.help.testFiltercriteria": "Additional criteria to filter tests from Test assemblies. For example: `Priority=1|Name=MyTestMethod`. [More information](https://msdn.microsoft.com/en-us/library/jj155796.aspx)",
"loc.input.label.runOnlyImpactedTests": "Run only impacted tests",
Expand Down
9 changes: 9 additions & 0 deletions Tasks/VsTestV2/inputparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AreaCodes, DistributionTypes } from './constants';
import * as idc from './inputdatacontract';
import * as Q from "q";
import * as isUncPath from 'is-unc-path';
import { stringify } from 'querystring';
vagisha-nidhi marked this conversation as resolved.
Show resolved Hide resolved
const regedit = require('regedit');

let serverBasedRun = false;
Expand Down Expand Up @@ -166,6 +167,14 @@ function getTestReportingSettings(inputDataContract : idc.InputDataContract) : i
inputDataContract.TestReportingSettings.TestRunTitle = tl.getInput('testRunTitle');
inputDataContract.TestReportingSettings.TestRunSystem = 'VSTS - vstest';

const resultsDir = tl.getInput('resultsDirectory');
if (utils.Helper.pathExistsAsDirectory(resultsDir.trim()))
vagisha-nidhi marked this conversation as resolved.
Show resolved Hide resolved
{
inputDataContract.TestReportingSettings.TestResultsDirectory = resultsDir.trim();
tl.debug("TestResultsDirectory: " + resultsDir);
ci.publishEvent({ 'TestResultsDirectoryUi': resultsDir } );
}

inputDataContract.TestReportingSettings.TestSourceSettings = <idc.TestSourceSettings>{};
inputDataContract.TestReportingSettings.TestSourceSettings.PullRequestTargetBranchName = tl.getVariable('System.PullRequest.TargetBranch');
inputDataContract.TestReportingSettings.ExecutionStatusSettings = <idc.ExecutionStatusSettings>{};
Expand Down
13 changes: 11 additions & 2 deletions Tasks/VsTestV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 161,
"Patch": 1
"Minor": 162,
"Patch": 0
},
"demands": [
"vstest"
Expand Down Expand Up @@ -145,6 +145,15 @@
"helpMarkDown": "Folder to search for the test assemblies.",
"groupName": "testSelection"
},
{
"name": "resultsDirectory",
"type": "string",
"label": "Test results directory",
"defaultValue": "",
vagisha-nidhi marked this conversation as resolved.
Show resolved Hide resolved
"required": false,
"helpMarkDown": "Folder to store test results. Please make sure to clean up the the results directory before running tests to remove stale results.",
"groupName": "testSelection"
},
{
"name": "testFiltercriteria",
"type": "string",
Expand Down
13 changes: 11 additions & 2 deletions Tasks/VsTestV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 161,
"Patch": 1
"Minor": 162,
"Patch": 0
},
"demands": [
"vstest"
Expand Down Expand Up @@ -145,6 +145,15 @@
"helpMarkDown": "ms-resource:loc.input.help.searchFolder",
"groupName": "testSelection"
},
{
"name": "resultsDirectory",
"type": "string",
"label": "ms-resource:loc.input.label.resultsDirectory",
"defaultValue": "",
"required": false,
"helpMarkDown": "ms-resource:loc.input.help.resultsDirectory",
"groupName": "testSelection"
},
{
"name": "testFiltercriteria",
"type": "string",
Expand Down