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).
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?
<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?
Comments
http://www.simple-talk.com/sql/sql-tool ... tegration/
Although the example uses TeamCity, this applies to all CI tools.
Let us know how you get on.
David Atkinson
Red Gate
Product Manager
Redgate Software
Did you get the integration with your CI tool working using TestResults.xml?
David
Product Manager
Redgate Software
Thanks, David. I've amended my scripts.