-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix plus tests #1886
fix plus tests #1886
Changes from 2 commits
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 |
---|---|---|
|
@@ -10,8 +10,8 @@ var fs = require('fs'); | |
var xml2js = require('xml2js'); | ||
|
||
try { | ||
tl.setResourcePath(path.join( __dirname, 'task.json')); | ||
tl.setResourcePath(path.join(__dirname, 'task.json')); | ||
|
||
var vsTestVersion: string = tl.getInput('vsTestVersion'); | ||
var testAssembly: string = tl.getInput('testAssembly', true); | ||
var testFiltercriteria: string = tl.getInput('testFiltercriteria'); | ||
|
@@ -53,7 +53,7 @@ try { | |
} | ||
else { | ||
tl._writeLine("##vso[task.logissue type=warning;code=002004;]"); | ||
tl.warning("No test assemblies found matching the pattern: " + testAssembly); | ||
tl.warning(tl.loc('NoMatchingTestAssemblies', testAssembly)); | ||
} | ||
} | ||
catch (error) { | ||
|
@@ -108,8 +108,13 @@ function invokeVSTest(testResultsDirectory: string): Q.Promise<number> { | |
setRunInParallellIfApplicable(vsVersion); | ||
setupRunSettingsFileForParallel(runInParallel, overriddenSettingsFile) | ||
.then(function(parallelRunSettingsFile) { | ||
var vsCommon = tl.getVariable("VS" + vsVersion + "0COMNTools"); | ||
var vstestLocation = path.join(vsCommon, "..\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe"); | ||
var vstestPath = tl.getVariable("VSTest_" + vsVersion.toFixed(1)); | ||
if (!vstestPath) { | ||
tl.warning(tl.loc('VstestNotFound', vsVersion)); | ||
defer.resolve(1); | ||
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 1 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. 1 means task fails 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. |
||
return defer.promise; | ||
} | ||
var vstestLocation = path.join(vstestPath, "vstest.console.exe"); | ||
var vstest = tl.createToolRunner(vstestLocation); | ||
|
||
testAssemblyFiles.forEach(function(testAssembly) { | ||
|
@@ -164,7 +169,7 @@ function invokeVSTest(testResultsDirectory: string): Q.Promise<number> { | |
}) | ||
.fail(function(err) { | ||
cleanUp(parallelRunSettingsFile); | ||
tl.warning("Vstest failed with error. Check logs for failures. There might be failed tests"); | ||
tl.warning(tl.loc('VstestFailed')); | ||
tl.error(err); | ||
defer.resolve(1); | ||
}); | ||
|
@@ -197,7 +202,7 @@ function publishTestResults(testResultsDirectory: string) { | |
} | ||
else { | ||
tl._writeLine("##vso[task.logissue type=warning;code=002003;]"); | ||
tl.warning("No results found to publish."); | ||
tl.warning(tl.loc('NoResultsToPublish')); | ||
} | ||
} | ||
} | ||
|
@@ -214,7 +219,12 @@ function getFilteredFiles(filesFilter: string, allFiles: string[]): string[] { | |
function cleanUp(temporarySettingsFile: string) { | ||
//cleanup the runsettings file | ||
if (temporarySettingsFile && runSettingsFile != temporarySettingsFile) { | ||
tl.rmRF(temporarySettingsFile, true); | ||
try { | ||
tl.rmRF(temporarySettingsFile, true); | ||
} | ||
catch (error) { | ||
//ignore. just cleanup. | ||
} | ||
} | ||
} | ||
|
||
|
@@ -245,7 +255,7 @@ function overrideTestRunParametersIfRequired(settingsFile: string): Q.Promise<st | |
var parser = new xml2js.Parser(); | ||
parser.parseString(xmlContents, function(err, result) { | ||
if (err) { | ||
tl.warning("Error occured while reading run settings file. Error : " + err); | ||
tl.warning(tl.loc('ErrorWhileReadingRunSettings', err)); | ||
tl.debug("Error occured while overriding test run parameters. Continuing..."); | ||
defer.resolve(settingsFile); | ||
return defer.promise; | ||
|
@@ -337,7 +347,7 @@ function setupRunSettingsFileForParallel(runInParallel: boolean, settingsFile: s | |
var defer = Q.defer<string>(); | ||
if (runInParallel) { | ||
if (settingsFile && settingsFile.split('.').pop().toLowerCase() == "testsettings") { | ||
tl.warning("Run in Parallel is not supported with testsettings file."); | ||
tl.warning(tl.loc('RunInParallelNotSupported')); | ||
defer.resolve(settingsFile); | ||
return defer.promise; | ||
} | ||
|
@@ -363,14 +373,14 @@ function setupRunSettingsFileForParallel(runInParallel: boolean, settingsFile: s | |
var parser = new xml2js.Parser(); | ||
parser.parseString(xmlContents, function(err, result) { | ||
if (err) { | ||
tl.warning("Error occured while reading run settings file. Error : " + err); | ||
tl.warning(tl.loc('ErrorWhileReadingRunSettings', err)); | ||
tl.debug("Error occured while setting run in parallel. Continuing..."); | ||
defer.resolve(settingsFile); | ||
return defer.promise; | ||
} | ||
|
||
if (result.RunSettings === undefined) { | ||
tl.warning("Failed to set run in parallel. Invalid run settings file."); | ||
tl.warning(tl.loc('FailedToSetRunInParallel')); | ||
defer.resolve(settingsFile); | ||
return defer.promise; | ||
} | ||
|
@@ -432,16 +442,17 @@ function setRunInParallellIfApplicable(vsVersion: number) { | |
if (runInParallel) { | ||
if (!isNaN(vsVersion) && vsVersion >= 14) { | ||
var vs14Common = tl.getVariable("VS140COMNTools"); | ||
if ((vs14Common && pathExistsAsFile(path.join(vs14Common, "..\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\TE.TestModes.dll"))) || vsVersion > 14) { | ||
if (vsVersion > 14 || (vs14Common && pathExistsAsFile(path.join(vs14Common, "..\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\TE.TestModes.dll")))) { | ||
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. what is temodes.dll? 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. this dll determines if it is below update 1 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. and we r sure it wont be removed going forward? we cant guarantee that correct? In reply to: 67283885 [](ancestors = 67283885) |
||
setRegistryKeyForParallelExecution(vsVersion); | ||
return; | ||
} | ||
} | ||
resetRunInParallel(); | ||
} | ||
} | ||
|
||
function resetRunInParallel() { | ||
tl.warning("Install Visual Studio 2015 Update 1 or higher on your build agent machine to run the tests in parallel."); | ||
tl.warning(tl.loc('UpdateOneOrHigherRequired')); | ||
runInParallel = false; | ||
} | ||
|
||
|
@@ -497,11 +508,11 @@ function setRegistryKeyForParallelExecution(vsVersion: number) { | |
}; | ||
regedit.putValue(values, function(err) { | ||
if (err) { | ||
tl.warning("Error occured while setting registry key, Error: " + err); | ||
tl.warning(tl.loc('ErrorOccuredWhileSettingRegistry', err)); | ||
} | ||
}); | ||
} else { | ||
tl.warning("Error occured while creating registry key, Error: " + err); | ||
tl.warning(tl.loc('ErrorOccuredWhileSettingRegistry', err)); | ||
} | ||
}); | ||
} | ||
|
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.
version?
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.
will change