Teamcity没有';从powershell执行时,无法检测msbuild或nUnit故障
我已经使用psake编写了一个构建脚本,我在Teamcity中运行 我有Teamcity 6.0,所以我从.cmd运行psake,但我认为这不会改变任何事情 一切正常,但我有两个问题Teamcity没有';从powershell执行时,无法检测msbuild或nUnit故障,msbuild,nunit,teamcity,psake,Msbuild,Nunit,Teamcity,Psake,我已经使用psake编写了一个构建脚本,我在Teamcity中运行 我有Teamcity 6.0,所以我从.cmd运行psake,但我认为这不会改变任何事情 一切正常,但我有两个问题 Nunit没有与Teamcity沟通,因此当测试失败时,Teamcity表示一切正常 MsBuild的行为与此相同。即使构建失败,Teamcity仍报告成功 我想知道如何让Teamcity检测这些故障 以下是我的示例脚本:您可能需要通过其简单而优雅的通知Teamcity自己 例如,您可以在powershell脚本期
以下是我的示例脚本:您可能需要通过其简单而优雅的通知Teamcity自己 例如,您可以在powershell脚本期间将以下消息输出到stdout
##teamcity[buildStatus status='FAILURE' text='Some error message']
您可能需要通过简单而优雅的通知Teamcity 例如,您可以在powershell脚本期间将以下消息输出到stdout
##teamcity[buildStatus status='FAILURE' text='Some error message']
我让TeamCity工作的方式(我必须添加TeamCity版本6.5.4)是使用psake下载中提供的TeamCity模块 将以下内容添加到脚本中:
...
Import-Module "$build_dir\psake\teamcity.psm1"
#Tasks here
...
Remove-Module teamcity
#End Of File
我有一个构建文件夹,我把模块放在其中,这样我的所有构建都可以访问它
然后它就从盒子里出来了
不过,我没有使用内置的NUnit runner,我还将NUnit控制台放在我的构建文件夹中,然后用每个UnitTest程序集调用它:
Task Test -depends Build {
$testAssemblies = (get-childitem $base_dir -r -i "*UnitTests.dll" -exclude "*.config" -Name | Select-string "bin")
foreach($test_asm_name in $testAssemblies) {
$full_test_assembly_name = "$base_dir\$test_asm_name"
Exec { invoke-expression "$nunitconsole_path $full_test_assembly_name" }
}
}
我让TeamCity工作的方式(我必须添加TeamCity版本6.5.4)是使用psake下载中提供的TeamCity模块 将以下内容添加到脚本中:
...
Import-Module "$build_dir\psake\teamcity.psm1"
#Tasks here
...
Remove-Module teamcity
#End Of File
我有一个构建文件夹,我把模块放在其中,这样我的所有构建都可以访问它
然后它就从盒子里出来了
不过,我没有使用内置的NUnit runner,我还将NUnit控制台放在我的构建文件夹中,然后用每个UnitTest程序集调用它:
Task Test -depends Build {
$testAssemblies = (get-childitem $base_dir -r -i "*UnitTests.dll" -exclude "*.config" -Name | Select-string "bin")
foreach($test_asm_name in $testAssemblies) {
$full_test_assembly_name = "$base_dir\$test_asm_name"
Exec { invoke-expression "$nunitconsole_path $full_test_assembly_name" }
}
}
而且,幸运的是,TeamCity只是为了创建这些消息!这很管用,但我希望有一些神奇的东西。像mspec.exe一样,有一个
--teamcity
开关来产生这个。我希望TeamCity Nunit testrunner也有同样的东西。而且,幸运的是,TeamCity只是为了创建这些消息!这很管用,但我希望有一些神奇的东西。像mspec.exe一样,有一个--teamcity
开关来产生这个。我曾希望TeamCity Nunit testrunner也有同样的功能。我们执行xunit时是这样的:exec{&“$lib\u dir\xunit\xunit.console.clr4.exe”“$($p.BuildDir)\$($p.Name.dll)/Nunit“$($p.BuildDir)\results.xml”},效果非常好。但是,生成总是成功的,当出现测试问题时它应该失败。我们执行xunit时是这样的:exec{&“$lib\u dir\xunit\xunit.console.clr4.exe”“$($p.BuildDir)\$($p.Name.dll)/nunit“$($p.BuildDir)\results.xml”},它工作得很好。然而,构建总是成功的,当出现测试问题时,构建应该失败。