How do I generate Emma code coverage reports from Hudson? - hudson

I am trying to generate Emma Code Coverage Report from Hudson.
I have added "Record Emma coverage report" plugin in Hudson
This plug-in needs a path where generated emma xml report will be placed.
I have added that path "/opt/dfte/hudson" but it is saying that
Recording Emma reports /opt/dfte/hudson/emma.xml
Finished: FAILURE
Did I missed any steps??
Please help me.
Thanks

Your build needs to generate the Emma report. Hudson then picks up the XML file generated by the Emma run from your build, and renders it nicely.

You first need to integrate EMMA into your Maven or Ant build by following these instructions: http://wiki.hudson-ci.org//display/HUDSON/Emma+Plugin. If you are using Maven you can test these build changes by running "mvn emma:emma" -- if it's working you should have an emma directory under your site directories containing a coverage.xml and html files. While I haven't tried it with Ant, I believe it should be a similar process and output.
Once that is happening, you just need to enable the Hudson EMMA plugin by checking "Record Emma coverage report" in your job configuration. For the Maven example above (and likely Ant) you do not need to specify the file path as it will automatically find coverage.xml files in your modules. Make sure this Hudson job also executes your tests. You will then get a nice chart on your job's page showing % trends for class, method, block, and line coverage.

Related

Building and deployment of SSRS reports in Team Foundation Server 2018 Express

What kind of tasks or custom commands could be used to generate artifacts for rptproj projects during TFS build process and then to publish the reports to local ReportServer later during deployment process?
The long story.
I have a setup with separate Build and Deployment pipelines in TFS 2018 Express.
My Visual Studio 2017 solution has three ASP.NET MVC web app projects and two SSRS projects (rptproj).
Currently, I'm triggering a build using the following MSBuild parameters:
/p:DeployOnBuild=true /p:WebPublishMethod=Package
/p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true
/p:PackageLocation="$(build.artifactstagingdirectory)\\"
/p:AutoParameterizationWebConfigConnectionStrings=false
and also I have specified an output folder for artifacts.
After a build, the artifact folder contains three zip files for the websites and some deployment helper scripts. However, there is no any output from my rptproj projects (and I'm not sure what should the output be for these). The report projects are built without any issues, judging from the build log, they just don't generate any artifact outputs.
I have configured the deploy pipeline to take the zips and deploy to local IIS server. It works just fine, also web.config transforms get applied.
I did it all using TFS 2018 built-in tasks and everything seemed mostly straight forward. But there are no built-in tasks for SSRS.
I found some third party SSRS tasks in the TFS online gallery but, if I understand correctly, they all seem to be deploying immediately during build. I don't need that - I want first to collect the rptproj output in the artifacts and then later deploy it during the deploy pipeline step because sometimes I want to trigger a manual release for some older build without actually rebuilding everything.
I want first to collect the rptproj output in the artifacts and then later deploy it during the deploy pipeline step
You just stated the exact solution to the problem:
Add a Publish Artifacts task, point it to the folder containing your report output, and publish your reports as an artifact. Then it will be available in a release. In my experience, you don't need to "build" report projects, you can just publish the folder containing your reports from $(Build.SourcesDirectory)/Path/To/Your/Reports.

Visual Studio Team Services Building JSON Scripts

I'm currently building scripts using Selenium Builder (which saves files as JSON) and i'm having a hard time running these scripts on VSTS. My question specifically is, can Visual Studio Team Services build JSON scripts and tie them in with its C.I.? If so, which approach must I take in order to do this / make it possible?
Thanks!
Here is my steps for your reference:
Deploy your own private build agent by following this link.
Configure the required environment on the build agent like Selenium Driver, Firefox so that the testing can be run on the build agent.
Upload the json file generated by Selenium Builder into VSTS Repository.
Create a build definition with two Command Line tasks: The first one runs npm install command to install se-interpreter:
And the second one run se-interpreter command to run the test in json file:
Queue the build, you will see the test been executed during the build:

"The binary code for the script is not found"

I used the script found here
... And every time that I generate this dynamic package, it needs to open the script task and click "Ok" because the "The binary code for the script is not found." error aways appears. Is there a way to solve this without BIDS ? Thanks and sorry my bad english.
I got this error when a SSISDB was upgraded to 2016 from 2012 and the package was not re-deployed using newer visual studio with project set to deploy to SQL Server 2016 in the project deployment properties.
This is often caused to to an error or omission in the code in the script task. If you are certain that the code is correct you can go to the script properties and set the PrecompileiIntoBindaryCode to False, the default is set to true. This is under the Properties or in the Script option of the properties window.
This worked for us
From Project properties, change TargetServerVersion to SQL Server 2019 (Or desired version)
open the .dtsx file for each package in Notepad++ or other text editor
remove the following for each dtsx file (there will be 1 occurence per script component in packages)
<PropertyGroup>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
save the .dtsx file
go back into Visual Studio and rebuild the project file (as well rebuild individual script task)
I just ran into this error, after I changed my package deployment configuration to 2012. In the script some references we no longer linked. I had to reset the version of the .Net framework in the VS script environment, references were now legit, rebuild success.
In Visual Studio 2017, SSIS 2017 solution, had same error on a script task. Compared to another solution with similar process and discovered the issue was the Reference which had an error did not have a path listed for the dll. Removed the reference and added again. This resolved the issues.
Uninstall VS 2015 and SSDT 14.
Re Install VS 2015 and SSDT 14.
Open a new Integration project and import the SSIS project using the ispac file
Open the task having the error
Click On Edit Script.
Then either do this:
In Build tab click on Run code analysis on solution or Build or Clean and then Build
Save All the solution
Close the window
Click on OK in the task window.
OR just click on edit script and then OK button
The error should go off
This is for Visual Studio 2015 Community/SSDT 14
use SSMS V17.8.1 and upgrade your SSISDB and it will work, I tried it.
For me, I found that using string interpolation caused the issue.
For example:
This line caused the error:
command += $"test {property.Name}";
Changing it to this fixed the error:
command += "test " + property.Name;
After changing from VS 2017 to VS 2019, I saw this error in SQL Server / Integration Services Catalog / "My Package" / Validate... These messages are also visible in Standard Reports / All Executions.
My particular error messages were "VS_ISBROKEN" in the SSIS.Pipeline and "The binary code for the script is not found." in my scripting task.
I opened up the scripting task (C#) and changed the project target to x86 instead of None (MSIL), rebuilt it, closed the scripting solution, pressed Ok to keep the script changes, saved, built and deployed.
That worked for me.
Addendum:
It turns out that I was deploying a single package using VS2019 while the original Project was deployed using VS2017.
I think that the two deployments are not 100% compatible, and recommend that users either deploy an entire project, or deploy a package update using the same version as was used for the initial release.
You should probably ignore my suggestion above about changing project target.
Check your references, make sure all external references are added to the server's GAC.
For adding your dll(for example csvhelper.dll) in GAC you can use the following command in cmd.
C:\test>"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7 Tools\gacutil.exe" -i csvhelper.dll
**Put your dll in a folder (for example in test folder)
**Pay attention which version of .Netframework you have(Here I used .net4.7)

Junit reports for Hudson

I am able to successfully run my JUnit test suite from the command line and now I want run these tests from Hudson.
However , for Hudson to generate the reports , it needs a results file (I think in xml format) .
How do I generate a results file from JUnit ?
I am using the following command to run the tests :
java com.nvidia.tests.TestSuite1
Thanks in advance .
Parag.
If you're using ant, you can look at the JUnit task for ant. This is probably the easiest way. You can just add the task at the appropriate place in the script.
If you're using maven, look at the surefire plugin for maven which will automatically run the tests and create the reports in jenkins.
EDIT: If you're not using any build tool (which you should be), then just add the ant build script to jenkins, and you should get the reports automatically.

Execute command in Hudson as Post-build Actions

I am new in Hudson.
I would like to execute a 'sourcecodeanalyzer' command in Hudson as Post-build Actions to generate an html report. Please let me know is this at all possible, if yes let me know the Hudson configuration steps to execute the command.
Your earliest response in this regard will be extremely helpful.
Thanks in advance.
Yes, it is almost certainly possible.
You will need to configure the Hudson project to have either a post-build action or a build step that runs your source code analyzer.
You've not stated in your question precisely which analyzer - it may be that Hudson already has a plug-in installed for it, in which case it may be listed on the Config page for the project at the bottom under Post-build Actions.
If not, next check to see if there's a plug-in available for the analyzer that hasn't been installed. From the main Hudson page select Manage Hudson, then Manage Plugins, and choose the Available tab. If there is a plug-in available it's definitely a good idea to use it as they are generally very well integrated with Hudson itself.
As a last resort you'll have to configure a build step to run the analyzer. Configure the project, then choose "Add build step". The drop-down that appears depends on your environment (Windows or Linux) but should include the ability to run a shell command or batch file. You can configure your analyzer there.
(If you're building Windows Visual Studio applications, a more flexible way that I've used is to use the MSBuild plug-in for builds, and have an MSBuild script that builds the application and then runs analysis tools. This can automate pretty much everything: mine builds the application, builds an acceptance test database, runs the acceptance tests and copies the result HTML to a page linked from the project.)
You could create a new job with a "Execute Shell" build step. Type in the command you wish to run in the text box. Then all you have to do is trigger this job by selecting:
"Build after other projects are built"
And select the trigger job from the list.
Hope this helps!
As a follow up to Jeremy's post. If you don't see the ability to add post build steps, you might work with maven jobs. In that case you need the Hudson M2 Extra Steps Plugin. This will give you pre and post build steps.
I use the 'Post build task' plugin to delete some resources after a build. You could call any shell script or command lines. If you want you could make the call depends on some logging output.
there is one best way to solve this:
Upgrade to Fortify SCA 2.6.x (as of writing, latest version is 2.6.5).
Download the Fortify Maven Plugin version 2.6 from https://customerportal.fortify.com and install it into your Hudson server's Maven repository.
Update your project's pom to carry out the Fortify scan. There is an example provided with the Maven plugin.
Currently , I am experiment with sonar plug in. It looks great check the details here
http://sonar.codehaus.org/a-new-hudson-plugin-for-a-closer-integration-with-sonar/
http://wiki.hudson-ci.org/display/HUDSON/Sonar+plugin