can we customize Build email in Cruisecontrol.net..? - cruisecontrol.net

I am having a cruisecontrol.net version 1.5.7256.1 and i integrated project and unit test and the current behaviour is :
1) if code is checked in successfully and all unit test function passed then email notification is build successfull
2)if code is checked in successfully and any unit test function failed then email notification is build failed
the expected behaviour is if code is checked in successfully and any unit test function failed then email notification should be build passed but unit test failed.
In other words i want to customize the build emails.? is that possible
please help
Thanks,
Nilesh
Hi, I did the changes accordingly i added a condition to check test failed but its not showing while email notification.. is i am forgetting something... ?

Yes, it's possible to customize email output by modifying ccnet.exe.config.
In this file, XSL sheets are applied to build email.
dashboard.config file will customize the web dashboard.
Usually a successful build means every actions succeed, from compile to tests and deployment. Maybe you should reconsider the warning only email when test failed.

Related

Export e2e test results (specs steps) to Microsoft Team?

I have my e2e tests (using WebDriverIO) running on Gitlab Pipeline. I already setup a hook to connect to Microsoft Teams, so whenever the tests fail, I receive this message in Teams:
So, then I click on the Pipeline ID and check the specs to see which tests are failed and so on.
My question: is it possible (and how) to export also the specs into this message, for example, I would like to have the following specs as part of the message to Teams:

Get all Tests ran in Azure Build Pipeline through REST API

I'm trying to get a list of all tests ran from a Azure Pipeline build through the Azure REST API. I'm trying to use this API call but get an empty list every time:
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?buildUri={buildUri}&$top={$top}&api-version=6.0
where I'm using the BuildID as the buildUri. Should I be using something else as the buildUri? I only want the top test runs from one build pipeline, not from all pipelines in the project. Even better if I could only get all the tests from one run of the pipeline.
Currently, the only way I've found to solve this is by using the above call to get all runs (none of them have a Build property with data), so I can then use the ids from that call to make the following API call to get which build it is, and filter it manually from there. However, this is way more API calls and data downloaded than I wanted. I want a simple way to get all test runs from a build id.
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs/{runId}?api-version=6.0
I want a simple way to get all test runs from a build id.
As suggested by Xue Meng:
To get the results of each test run:
GET https://vstmr.dev.azure.com/{Orginazation name}/{Project name}/_apis/testresults/resultsbypipeline?pipelineId={buildID}&%24top=20000?api-version=5.2-preview.1
To get the total number of passed tests:
GET https://vstmr.dev.azure.com/{Orginazation name}/{Project name}/_apis/testresults/resultdetailsbybuild?buildId={buildID}&publishContext=CI&groupBy=TestRun&%24filter=Outcome%20eq%20Failed&%24orderby=&shouldIncludeResults=true&queryRunSummaryForInProgress=false?api-version=5.2-preview.1
According to Chubsdad, this seems to be working to get the test result by buildID:
GET https://vstmr.dev.azure.com{org}/{proj}/_apis/testresults/resultdetailsbybuild?buildId={id}&groupBy=TestRun

Invalid results file. ] result format of 'C:\Agents\Build\Agent1\_work\45\s\TestResults24_59.trx' matches 'VSTest' test results format

I have a unit test written in visual studio with login flow. And It runs perfectly when running locally. But when I push the code in Azure repo and create a new build in azure pipeline. In "VSTest" I face this warning
"Invalid results file. Make sure the result format of the file
'C:\Agents\Build\Agent1_work\45\s\TestResults\MS$_MS_2019-04-21_12_24_59.trx'
matches 'VSTest' test results format."
And after creation of build no test is available in Tests tab.

Getting java.lang.IllegalArgumentException error while running cucumber feature file in Java Eclipse

I am trying to run a basic cucumber feature file via JAVA ECLIPSE on my MacBook and getting this java.lang.IllegalArgumentException error .
Following steps are taken care.
Added the dependencies
Created a Maven project
Created a feature file
Created a Runner Class
Created a Step Definition class
Trying to run the feature file so that I will get the implementation steps as part of errors in consolidating so that I can use the same in the step definition file.
Feature file :
Feature: POC on gmail Login Page
Scenario: gmail login test
Given User navigated to gmail Login page
When User enter the Loginid
And User enter Password for gmail
And User click on Login button
Then Verification Page Displayed
Then Inbox page is displayed
Error in detail:
Exception in thread "main" java.lang.IllegalArgumentException: Not a file or directory: /Users/civakalyan/Documents/Java Eclipse/FIrstCucumberMavenProject/--plugin
at cucumber.runtime.io.FileResourceIterator$FileIterator.(FileResourceIterator.java:54)
at cucumber.runtime.io.FileResourceIterator.(FileResourceIterator.java:20)
at cucumber.runtime.io.FileResourceIterable.iterator(FileResourceIterable.java:19)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:38)
at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:117)
at cucumber.runtime.Runtime.run(Runtime.java:92)
at cucumber.api.cli.Main.run(Main.java:20)
at cucumber.api.cli.Main.main(Main.java:12)
U have to build the path etc, restart eclipse. Try making a new Fresh Project with the same feature file and run it.
it worked for me , however still looking for a better solution

Jenkins Java: How to get the userid of the user who triggered the build in jenkins

Is there a way to find out who started a build in jenkins using java. I understand that below is the approach for figuring out as to who started a build
import hudson.model.*
import jenkins.security.*
def userBuild
for(hudson.model.Cause cause : build.causes) {
userBuild = cause.getUserName()
}
println "Build Started by: "+userBuild
Likewise, can someone please let me know if there is a similar working way to figure out as to who initiated a jenkins build?
Ther is a Plugin that injects the informations in Build Variables.
https://wiki.jenkins-ci.org/display/JENKINS/Build+User+Vars+Plugin
BUILD_USER – full name of user started build,
BUILD_USER_FIRST_NAME – first name of user started build,
BUILD_USER_LAST_NAME – last name of user started build,
BUILD_USER_ID – id of user started build.
Maybe this is an option for you.
Was able to figure it out on my own. Added the below changes in buildCaption.jelly so that only the user who started the build will be able to abort the build. Mind that this change only gets reflected in the console-output of a build, but there are other places(such as jenkins landing page and job home page) where the abort button gets displayed and will have to make the changes accordingly
<j:forEach var="cause" items="${it.causes}">
<j:if test="${cause.userName == it.currentlyLoggedInUser}">
<l:stopButton href="stop" alt="[${%cancel}]"/>
</j:if>
</j:forEach>

Resources