cruisecontrol.net email - cruisecontrol.net

On CruiseControl.net there is a link called “NUnit Details”. When you click on this it gives a lot of details including a summary section that looks similar to this…
Summary
Assemblies tested: 2
Tests executed: 56
Passes: 54
Fails: 2
Ignored: 2
I would like the summary emailed to me on every build. Any tips would be great.

The format of the e-mail is configured in the ccnet.exe.config or ccservice.exe.config (in C:\Program Files\CruiseControl.NET\server) if you are running ccnet a service.
I believe the file that you want to include is tests.xml as that includes a detailed listing of the nunit test results. Modify the xslFiles section of the configuration file to include this stylesheet. It will look something like this.
<!-- Specifies the stylesheets that are used to transform the build results when using the EmailPublisher -->
<xslFiles>
<file name="xsl\header.xsl"/>
<file name="xsl\compile.xsl"/>
...
<!-- add tests.xsl here... -->
<file name="xsl\tests.xsl"/>
</xslFiles>

Related

Analyzing Coded UI Tests Using Coded UI Test Logs

i am trying to get the html log file for the coded ui tests.
i tried the steps mentioned in the following link
https://msdn.microsoft.com/en-us/library/jj159363(v=vs.110).aspx
By default it generated .png file(image file) which captures only the screenshot of the active window where the error occurred.
So i tried using the other values for "EqtTraceLevel" in the configuration file, but there is no difference, it still generates image file.
Does it work for Windows application? if it does what are the additional settings required?
To enable HTML logging in your tests you should add Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot; to your test.
This will show all steps taken in your test and a corresponding screenshot of your application under test. It will also show you a highlight rectangle to show the found control.
Alternatively change QTAgent32.exe.config or QTAgent32_40.exe.config in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE (or where you have VS installed) to contain the following settings:
<appSettings>
<!--- Your settings -->
<add key="EnableHtmlLogger" value="true"/>
</appSettings>
And to increase the detail of your logging:
<switches>
<add name="EqtTraceLevel"value="4"/>
</switches>
Where 0 is off, 1 for errors, 2 for warnings, 3 for info and 4 for verbose.

Distribute SQL_SSDT Code Snippets using vscontent (lang attribute error)

I'm trying to distribute some SQL_SSDT Visual Studio code snippets using .vsi and .vscontent files, but I'm getting an error while installing:
The .vscontent file either contains invalid attributes or specifies a code snippet for a programming language that is not installed.
The .vscontent file is based on the documentation provided by Microsoft How to: Distribute Code Snippets
The sample on this site is the following:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName> </FileName>
<DisplayName> </DisplayName>
<Description> </Description>
<FileContentType> </FileContentType>
<ContentVersion>2.0</ContentVersion>
<Attributes>
<Attribute name="lang" value=""/>
</Attributes>
</Content>
</VSContent>
My file looks like this:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName>SSDTTest.snippet</FileName>
<DisplayName>SSDTTest</DisplayName>
<Description>SSDTTest</Description>
<FileContentType>Code Snippet</FileContentType>
<ContentVersion>1.0</ContentVersion>
<Attributes>
<Attribute name="lang" value="SQL_SSDT"/>
</Attributes>
</Content>
</VSContent>
I'm using the value SQL_SSDT since this is the required value in the .snippet files (<Code Language="SQL_SSDT">).
The installation starts as expected (double clicking on the .vsi file), the VS Content Installer pops up, lists the included content. The error occurs after hitting Finish. (Installation starts, but the above error pops up after a few seconds.)
The snippet is working fine if I copy it to the default snippet folder for SSDT (Documents\Visual Studio 2012\Code Snippets\SQL_SSDT\My Code Snippets) or if I'm adding it via snippet manager in SSDT, but the .vsi installation fails using the above file.
Am I missing something?
Installed VS products on this box:
SSDT
SSDT-BI
VS Express for Desktop (2012)
Update
I found the XML schema reference for the .vscontent files (VS2012), and it seems that the SQL_SSDT is not a valid value for the Lang attribute. It suggests that there are only four values available for the lang attribute. (csharp, jsharp, vb, xml).
Now the question is: Does SSDT add any extensions to this XML schema?
It seems that VS Content Installer has no support for deploying SSDT code snippets. There is a posted idea on visualstudio.uservoice.com which requests this feature, but it is still open.
I did not found any other resources related to this issue.
There is a possible workaround, which needs testing: You can create a PS/BAT which copies the snippet files into the VS's snippet folder for SSDT.

Can I specify multiple possible sources for a ccnet statistic?

I have some builds that use NCover for test coverage analysis, and some that use DotCover. I merge the NCover/DotCover summary report into the ccnet log, but the item that I need to pull out into the ccnet "Coverage" statistic is different depending on the tool (because the format of the reports are different).
For NCover, I use the following:
<statistics>
<statisticList>
<firstMatch name="Coverage"
xpath="//coverageReport/project/#coverage"
generateGraph="true" />
</statisticList>
</statistics>
For DotCover, I need this:
<statistics>
<statisticList>
<firstMatch name="Coverage"
xpath="//Root/#CoveragePercent"
generateGraph="true" />
</statisticList>
</statistics>
Is there any way to specify both? If I just list both sections inside the statisticList, the second one always wins (so if I list DotCover second, builds that use NCover have their coverage stat set to zero, because the DotCover stat can't be found). What I want is for the stat to get set to the NCover stat if it exists, or to the DotCover stat if it exists.
Thanks for the help!
You might be able to do an OR in the xpath expression, for example:
<statistics>
<statisticList>
<firstMatch name="Coverage"
xpath="//Root/#CoveragePercent | //coverageReport/project/#coverage"
generateGraph="true" />
</statisticList>
</statistics>

CruiseControl.NET Visual Studio Test Cases not showing up on dashboard

I'm using CruiseControl.NET to run visual studio test cases after my project builds. In the raw xml log I can see it running the test cases and saying which passed and which failed, however on the CruiseControl dashboard all it says is:
9 Projects built with no warnings at all :-)
Juchuu !!!
Here's what my project block looks like:
<project name="projectname" queue="queuename" queuePriority="2">
<workingDirectory>C:\Build</workingDirectory>
<category>categoryname</category>
<webURL>http://myurl/ViewProjectReport.aspx</webURL>
<triggers>
<intervalTrigger seconds="60" />
</triggers>
<modificationDelaySeconds>60</modificationDelaySeconds>
&sc;
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>C:\mypath</workingDirectory>
<projectFile>project.sln</projectFile>
<buildArgs>/v:quiet /noconlog /p:Configuration=Debug</buildArgs>
<targets>Build</targets>
<timeout>900</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCnet.dll</logger>
</msbuild>
<exec>
<executable>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe</executable>
<baseDirectory>C:\Build\Test\TestCases\</baseDirectory>
<buildArgs>/testcontainer:testproject\bin\debug\testproject.dll /runconfig:localtestrun.Testrunconfig</buildArgs>
<buildTimeoutSeconds>900</buildTimeoutSeconds>
</exec>
</tasks>
<publishers>
<xmllogger logDir="C:\Program Files\CruiseControl.NET\Logs\Navtrak\H4CommandProcess\" />
</publishers>
</project>
How do I get the passed/failed test cases to show up on the cruisecontrol dashboard page for that specific build?
Thanks,
Justin
See this article for some tips on how to get MSTest results to appear in CruiseControl.Net:
http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+MSTest
Essentially what you need to do is:
Get MSTest to save its test results to an xml (.trx) file (your raw build output might show test results in a test format, however CruiseControl.net needs the results in xml format)
Get CruiseControl.Net to merge this xml file into your cruise control build log.
Add an extra build report that uses an XSLT to show transform the xml test results into pretty html.
The above article goes into more detail on how to do this, as well as a couple of extra considerations (such as deleting old test results).
Also, I've noticed that you are using Visual Studio 2009 - something that the above article does not emphasis is that when you are setting up your dashboard to shown MSTest results, you need to make sure you use the VS2009 specific xslt in the CruiseControl.Net directroy, as the standard one won't display any results on the dashboard.

Include build output as attachment

We have a CruiseControl.NET Server 1.5.0.4401 running. One project uses an external compiler, which is included via exec-task. This compiler is configured to write its output into a textfile that is located in the artifact directory. The filename is keil_Revision-x.txt (x is the revision number) whereas the configuration for this file looks like %ccnetartifactdirectory%\keil_%ccnetlabel%.txt.
We want this output file to be attached to the e-mail report CC is sending for each build. The configuration of the email-publisher is (a bit shortened) the following:
<email from="buildmaster#xxx.yy" mailhost="zzz" mailport="25" includeDetails="TRUE" useSSL="FALSE">
<users>
<!-- Here are some users -->
</users>
<groups>
<!-- Here are some groups -->
</groups>
<converters>
<!-- LDAP converter-->
</converters>
<modifierNotificationTypes>
<!-- Several notification types -->
</modifierNotificationTypes>
<subjectSettings>
<!-- Here are some subject settings -->
</subjectSettings>
<attachments>
<file>${CCNetArtifactDirectory}\keil_${CCNetLabel}.txt</file>
</attachments>
</email>
The only problem is, that the files are not attached. The debug output on the cruise control console doesn't contain any error message. The artifact directory contains all files, only they are not attached. Where is the failure?
Are Integration Properties like CCNetLabel available inside CCNET configuration? I venture to doubt that. Up to CCNET 1.4.4 SP1 they weren't. So please check the attachment node in Your project configuration to see if CCNetLabel has been resolved properly.
You need to define preprocessor constants that can replace the integration properties like this:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:define project.artifact.dir="C:\foodir" />
<project name="foo">
<artifactDirectory>$(project.artifact.dir)</artifactDirectory>
...
<publishers>
...
<email
from="buildmaster#xxx.yy"
mailhost="zzz"
mailport="25"
includeDetails="TRUE"
useSSL="FALSE">
....
<attachments>
<file>$(project.artifact.dir)\keil.txt</file>
</attachments>
</email>
</publishers>
</project>
</cruisecontrol>
You need to instruct your compiler to write the results to a file whose name is predictable by CCNET configuration. Since configuration has no access to the label it must not be part of the filename. If you want to keep the result files from being overwritten by each build, add an executable task that triggers a simple batch file whose purpose is to copy %ccnetartifactdirectory%\keil.txt to %ccnetartifactdirectory%\keil_%ccnetlabel%.txt.
Otherwise the answer to this question might help here as well.

Resources