如果我使用以下测试设置在本地运行测试,一切运行正常。然而,当我在teamcity服务器上运行测试时,量角器测试会在不到一秒的时间内完成,并且所有测试都会通过。似乎没有任何承诺会解决,基本上测试根本不做任何事情。但是,如果我添加非异步断言
String nameStr = nameof(FlightControllerController);
nameStr = nameStr.Substring(0, nameStr.LastIndexOf("Controller"));
失败并正确报告错误。
Test.ps1:
except(1).toBe(2);
Gulp任务:
[CmdLetBinding()]
Param()
$env:path += ";C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\"
Push-Location $PSScriptRoot\..\
"Starting azure table storage emulator."
if (AzureStorageEmulator.exe status | select-string "IsRunning: False") {
AzureStorageEmulator.exe start
}
"Clearing existing data from storage."
AzureStorageEmulator.exe clear all
"Running server side tests."
dnx test
"Protractor"
Get-Process -Name *chrome* | Stop-Process
$handle = Start-Process -FilePath "dnx" -ArgumentList "web-e2e" -PassThru
try {
$results = gulp protractor
$results
if($results | select-string "error code") {
throw "Protractor test failed."
}
}
finally {
try {
$handle.Kill()
} catch {}
Get-Process -Name *chrome* | Stop-Process
}
Pop-Location
protractor.conf:
gulp.task('protractor', (cb) => {
child_process.exec(`node ${__dirname}\\node_modules\\protractor\\lib\\cli.js .\\protractor\\protractor.conf.js --directConnect`, (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
团队城市日志:
exports.config = {
framework: 'jasmine',
specs: ['**/*.spec.js'],
directConnect: true,
baseUrl: 'http://localhost:5000/'
};
我测试了当我明确地破坏异步(例如将更改元素id作为无意义)。它在本地失败,在TC上它仍然通过。
我有点卡在这里,可能是--direct-connect导致问题落后,但它也使设置更简单。