TFS 2013 does not publish .coverage file on server - code-coverage

I'm developing a quality workflow with TFS 2013 and SonarQube 4.5.1. Everything works fine except one thing: I can't integrate code coverage data from TFS to SonarQube. The problem is that SonarQube needs .trx or .cover files to work.
However, my TFS Build doesn't publish those files. What I've done: I created a CodeCoverage.runsettings file that I mapped on my build with "User defined" type. (With CodeCoverageEnabled it doesn't work either.) In the file CodeCoverage.runsettings, I wrote the following XML tag:
<RunConfiguration>
<ResultsDirectory>.\TestResults</ResultsDirectory>
</RunConfiguration>
in the hope that it would write all the results files in the same directory. The build does indeed create the results directories, but none of them contain .coverage files. However, at the end of the build, in the results page, I can download a .coverage file. Do you know how I can force the writing of this .coverage file on the server? When I run analysis on my local config, the file is created in the test results directory.

Related

Build vNext CodedUI Item Deployment - items specified in .testsettings not being copied

I have a CodedUI test suite. I'm attempting to use a B-D-T workflow in TFS 2015 R2 to deploy the test .dlls to a machine group and execute them.
The tests rely on a couple files - an html start page and an XML file.
First, I attempted to have the tests just run from the bin folder OR where they're deployed onto the machines in the machine group. No suggestions I found on SO or on the first 3 pages of google worked. Whenever I ran a test locally it would copy the test dlls to the TestResults folder and execute from there.
Then, I attempted to use a .testsettings file to deploy the files with the .dlls into the TestResults folder. I still truly don't understand why this is the best or only solution - if I can just execute from the Bin please let me know how, but it does work - locally.
Now in TFS 2015 when I deploy my testing software to the test agent(Member of the machine group), I can see my supporting files exactly where they should be in the test drop location. Then, the test starts. A temp folder is created in a byzantine region of AppData, where only the .dlls and config are copied - not the files specified in the .testsettings file! The testsettings file is specified in the "Run Functional Tests" task, which I reached by browsing to the correct file in source control.
I can provide any information you require. This should be so simple but it has been an enormous headache.
In the configuration you need to setup where you copied the files to on the remote machine using a "Windows Machine File Copy" task executed by the agent. You need to make sure all the files needed to run are copied to the server.
Then in your .testsettings file specify which of the files you copied over you want to deploy to the temporary test context directory. Only files already copied to the test agent can be selected here.
The File copy task would look something like:

How to include Web.config in the TFS 2015 Contents section

I am trying to produce artifacts with TFS 2015.
Everything works fine except it does not include my Web.config file, which is vital to our application.
How can I get TFS to include my Web.config file in the "contents" area of the "Publish Build Artifacts" step of our build?
I have tried:
Web.config
*.*.config
*.*.xml
**\.xml
These are working:
**\bin
**\Content
**\fonts
**\Models
**\Scripts
**\Views
I believe you can use *.config
Did you really want to exclude any files? If not ** should include everything in the root.
If you are trying to reproduce what you can do when publishing from Visual Studio the you need to pass the correct MSBuild options to create the msdeoloy .zip file. You can the. Mearly capture *.zip...
Enter: “/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.SourcesDirectory)"” in the MS Build arguments…
When you build the output should include the same output in a zip as is created from the VS ui. You can also pass publish profiles and other parameters.

Jenkins with MSTest plugin : "mstest xml coverage report file not found"

In my build process, the VsTest.console tests my dll and generates a TestResults\a.trx file. The only parameter I added (more than dll path) is a .runsettings file.
The .trx file is not empty, the xml inside is quite explicit about what have been done. Double-clicking on the trx file opens vs2013 and results + coverage are displayed as it should.
Then, I want to publish the coverage results with jenkins MSTest plugin but it fails because it looks for a file that does not exists. Here are the output log :
MSTest: Processing tests results in file(s) TestResults\a.trx
MSTest: C:\Program Files (x86)\Jenkins\workspace\tepp\TestResults\a.trx
mstest xml coverage report file not found: C:\Program Files (x86)\Jenkins\workspace\tepp\TestResults\mstest-coverage.xml
Should it be better to use the MSTest-runner plugin ?
If not, what did I missed in my build process ?
The problem seems converting MSTest code covarage results in to XML
Have you tried something like TRX2HTML or TRXER ? (The convert them to htm so you can view using publish artifacts plugin)
TRXER
TRX2HTML
I also found this
Can you tell me your build steps?

MSBuild not copying files with PublishProfile

I have a Visual Studio 2013 solution with the full Orchard source code. When I use "Publish..." on the "Orchard.Web" project in Visual Studio, it correctly publishes the site to the File System destination I've configured into the .PubXml file that I used.
However, if I build this site using Jenkins, the files do not get copied to the destination. I've created a separate PubXml file that is used by Jenkins.
In my Jenkins job, I have two Build steps of interest. The first uses the src\Orchard.sln file with a command line argument of /p:Configuration=Release. This runs correctly, and builds the entire solution.
The second Build step, immediately after, uses the Build File of src\Orchard.Web\Orchard.Web.csproj and these command line arguments:
/p:DeployOnBuild=true
/p:PublishProfile="D:\workspace\Site\trunk\src\Orchard.Web\Properties\PublishProfiles\Jenkins.pubxml"
/p:VisualStudioVersion=12.0
/p:Configuration=Release
/p:Platform=AnyCPU
/v:minimal
/nologo
/p:WarningLevel=1
With this, the build and deploy seems to work - but doesn't. Here are some lines from the build output:
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
Auto ConnectionString Transformed obj\Release\Package\PackageTmp\Shapes\Scripts\Web.config into obj\Release\CSAutoParameterize\transformed\Shapes\Scripts\Web.config.
(... about 200 more "Auto ConnectionString..." lines...)
Finished: SUCCESS
No where does it actually copy the files to the destination defined in the PUBXML file.
In contrast, in Visual Studio, the output looks similar, but transforms only 4 config files and includes lots of "Publishing folder x" lines:
(...)
Transformed Modules\SH.GoogleAnalytics\web.config using ....
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
Publishing folder /...
Publishing folder bin...
(etc.)
(I have installed the latest Windows Azure SDK for .NET on the Jenkins server.)
I have the same trouble,that work for me:
/t:Rebuild
/p:DeployOnBuild=true
/p:PublishProfile=Jenkins_Publish
/p:Configuration=Release
do not use /p:VisualStudioVersion=xxx
This is kind of old, but I actually just set up Orchard to be able to get built via command line and MSBuild. Here is what I did:
/p:VisualStudioVersion=12.0;PublishProfile="example-profile";DeployProjA=true;FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v4.5";Configuration=Release;PublishProfileRootFolder=c:\Workspace\src\Orchard.Web\Properties\PublishProfiles;Password=ExamplePass
Since you are using Orchard you want to make sure that only the Orchard.Web project gets published so do not use DeployOnBuild=true. This will attempt to deploy every web project in the solution, which is a lot for Orchard. Instead follow the guidelines here to see how to deploy only the web project: http://sedodream.com/2013/03/06/HowToPublishOneWebProjectFromASolution.aspx

Produce CREATE DATABASE script using Database Project and TFS 2013 Build Automation

I would like to create a TFS 2013 build definition, which builds a SQL project and outputs the complete CREATE DATABASE script to the bin folder.
When I compile my project on the local machine, the SQL script is output to the bin[configuration] folder correctly as per the database project settings.
However when I build the same project using TFS build automation, the build succeeds but no bin folder is created and no sql script is output.
Any ideas what I'm doing wrong?
Additionally, when the script is output locally, the paths are blank:
:setvar DefaultDataPath ""
:setvar DefaultLogPath ""
Any idea how I can populate these for SQL Server 2008 r2 defaults?
Edit:
Actually, if I set the build to target only the .sqlproj file, then the bin is output correctly. The problem comes when the sqlproj is built as part of a solution with other projects.
The build agent does not create individual bin folders in the src working directory; only the start-up project's output is produced and copied to the final bin folder.
I would like the build to generate the sql script and copy it to the output folder along with the other project outputs.
Is this possible?
I ended up going with a workaround based upon This Answer.
If I build the database project as part of the solution, the script does end up in the drop folder, just not the build agent's working folder.
Using:
<CommentOutSetVarDeclarations>True</CommentOutSetVarDeclarations>
in the publish profile allows me to set the default path etc. from the command prompt which was an acceptable alternative in my case.

Resources