| 1 | |
| 2 | === Visual studio (ms build tools) integration with bitten === |
| 3 | |
| 4 | This is more of working draft. |
| 5 | |
| 6 | You should set up the bitten-slave environment with C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat or equivalent for your visual studio setup (this one is for vs 2008) |
| 7 | |
| 8 | You should probably do a batch file for invoking bitten-slave like this one |
| 9 | |
| 10 | {{{ |
| 11 | |
| 12 | call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" |
| 13 | |
| 14 | bitten-slave https://www.eaxmple.org/projects/my_project/builds |
| 15 | }}} |
| 16 | |
| 17 | '''Sidenote:''' if you do not add call before the vcvarsall your batch will exit before running bitten-slave |
| 18 | |
| 19 | == Build == |
| 20 | |
| 21 | Your build step should look something like |
| 22 | {{{ |
| 23 | <sh:exec executable="msbuild" args="project.sln /t:rebuild"/> |
| 24 | }}} |
| 25 | |
| 26 | see http://msdn.microsoft.com/en-us/library/ms164311.aspx for other msbuild options |
| 27 | |
| 28 | |
| 29 | == Running mstest == |
| 30 | |
| 31 | {{{ |
| 32 | <sh:exec executable="mstest" args="/testmetadata:Project.vsmdi "/> |
| 33 | }}} |
| 34 | |
| 35 | This executes all the tests in your project (TODO: test it without the /testlist:listname argument) |
| 36 | Also it's highly probable that you don't want all tests runned (I do a lot of manual UI tests, wich require user interaction, not a good practice but...), so you should add a test list in visual studio ide (double click on the vsmdi, test lists, right click, new test list, add your tests there) and use this command instead |
| 37 | |
| 38 | {{{ |
| 39 | <sh:exec executable="mstest" args="/testmetadata:Project.vsmdi /testlist:<list_name>"/> |
| 40 | }}} |
| 41 | |
| 42 | see http://msdn.microsoft.com/en-us/library/ms182489.aspx for more mstest options |
| 43 | |
| 44 | == Running NUnit == |
| 45 | |
| 46 | I don't use NUnit, but still this should be added for complete reference. |
| 47 | |
| 48 | == XSLT == |
| 49 | |
| 50 | You apply this xslt to the trx output of mstest. Be sure to check the vs namespace in line: |
| 51 | {{{ |
| 52 | xmlns:vs="http://microsoft.com/schemas/VisualStudio/TeamTest/2006" |
| 53 | }}} |
| 54 | against the xml namespace in the trx file, as it may get changed with any update of vs (probably won't but still) or with a diffrent version (ie teamsuite) |
| 55 | |
| 56 | {{{ |
| 57 | <?xml version='1.0'?> |
| 58 | <xsl:stylesheet version="1.0" |
| 59 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 60 | xmlns:vs="http://microsoft.com/schemas/VisualStudio/TeamTest/2006" |
| 61 | > |
| 62 | |
| 63 | <xsl:template match="/"> |
| 64 | <unit_tests> |
| 65 | <xsl:apply-templates /> |
| 66 | </unit_tests> |
| 67 | </xsl:template> |
| 68 | <xsl:template match="//vs:Results/vs:UnitTestResult" > |
| 69 | <test> |
| 70 | <status> |
| 71 | <xsl:if test="@outcome = 'Passed'">success</xsl:if> |
| 72 | <xsl:if test="@outcome != 'Passed'">failure</xsl:if> |
| 73 | </status> |
| 74 | <fixture>noname</fixture> |
| 75 | <type>test</type> |
| 76 | <name> |
| 77 | <xsl:value-of select="@testName" /> |
| 78 | </name> |
| 79 | <stdout> |
| 80 | <xsl:value-of select="vs:Output//*" /> |
| 81 | </stdout> |
| 82 | </test> |
| 83 | </xsl:template> |
| 84 | </xsl:stylesheet> |
| 85 | }}} |