Edgewall Software

Changes between Initial Version and Version 1 of Ms Test Xslt


Ignore:
Timestamp:
Dec 18, 2008, 4:24:10 PM (15 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Ms Test Xslt

    v1 v1  
     1
     2=== Visual studio (ms build tools) integration with bitten ===
     3
     4This is more of working draft.
     5
     6You 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
     8You should probably do a batch file for invoking bitten-slave like this one
     9
     10{{{
     11
     12call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
     13
     14bitten-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
     21Your build step should look something like
     22{{{
     23        <sh:exec executable="msbuild" args="project.sln /t:rebuild"/>
     24}}}
     25
     26see 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
     35This executes all the tests in your project (TODO: test it without the /testlist:listname argument)
     36Also 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
     42see http://msdn.microsoft.com/en-us/library/ms182489.aspx for more mstest options
     43
     44== Running NUnit ==
     45
     46I don't use NUnit, but still this should be added for complete reference.
     47
     48== XSLT ==
     49
     50You 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}}}
     54against 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}}}