| Author |
Message |
JackAce
Joined: 08 Jul 2011 Posts: 28
|
Posted: Sat Jul 14, 2012 7:42 pm Post subject: How can you get a build to fail when the tests fail? |
|
|
I am trying to use MSBuild and SQLCMD to run my tSQLt tests as part of the build/deploy process, but when MSBuild executes the tests, the command result is always a success (even when a test fails).
| Code: |
<Target Name="Test">
<Message Text="==================================================" />
<Message Text="== Run tSQLt Tests" />
<Message Text="==" />
<Exec Command=""$(SqlCmdPath)" -Q "EXEC tSQLt.RunAll" -S localhost -d MyDb -E" />
<Message Text="==================================================" />
</Target>
|
Is there a way to get the sqlcmd command to fail when the tests fail?
Another question:
Can the tests produce an XML file that can be parsed and used for reporting on a CI server such as Jenkins or TeamCity? |
|
| Back to top |
|
 |
David Atkinson
Joined: 05 Dec 2005 Posts: 1079
|
|
| Back to top |
|
 |
JackAce
Joined: 08 Jul 2011 Posts: 28
|
Posted: Sat Jul 14, 2012 11:07 pm Post subject: |
|
|
In case anyone else was wondering, I found the solution to the build failure problem. You can cause sqlcmd.exe to fail if you use the -b option
| Code: |
<Target Name="Test">
<Message Text="==================================================" />
<Message Text="== Run tSQLt Tests" />
<Message Text="==" />
<Exec Command=""$(SqlCmdPath)" -Q "EXEC tSQLt.RunAll" -S localhost -d MyDb -b -E" />
<Message Text="==================================================" />
</Target>
|
|
|
| Back to top |
|
 |
David Atkinson
Joined: 05 Dec 2005 Posts: 1079
|
Posted: Sat Jul 14, 2012 11:16 pm Post subject: |
|
|
Glad you got that working.
Did you get the integration with your CI tool working using TestResults.xml?
David |
|
| Back to top |
|
 |
JackAce
Joined: 08 Jul 2011 Posts: 28
|
Posted: Sat Jul 14, 2012 11:41 pm Post subject: Re: |
|
|
Thanks, David. I've amended my scripts. |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group