How to integrate the groovy test runner with Bamboo or any CI server?

Is it possible somehow to run groovy tests using Bamboo or any CI server? At this moment I should go to JIRA and manually run Unit test runner. This is quite uncomfortable.

2 answers

1 accepted

This widget could not be displayed.

I'm going to briefly outline the process of what we do to run tests in Bamboo through ScriptRunner.

We run tests from Bamboo using a Gradle task by executing the unit test built-in script remotely using a REST call. One advantage of using Gradle is you can write your own code to do this.

You need to do a POST call to the following endpoint: 

<jira-base-url>/rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.common.admin.RunUnitTests

The payload should be JSON and look like the following:

{
	"scriptParams": {
		"content": {
            // What packages to scan for
			"FIELD_SCAN_PACKAGES": "com.some.test.package",
            // What tests/packages to run
			"FIELD_TEST": ["com.some.test.package"]
		}
	}
}

The challenge is running JIRA as part of your build. If you have a way of firing it up then great, if not we use the Cargo plugin as our web container and deploy the JIRA webapp there. You will need to wait till its started up before running the tests, we do this by polling the REST endpoint above until we get a 200 status code back to indicate the tests are running.

After that we use the JUnit Parser in Bamboo to record the test results. The test results can be found under a folder called:

<catalina.out>/surefire-reports 

catalina.out is a system property. You can get it by running the following in the script console:

System.getProperty("catalina.home")

I've probably missed some things, but thats an overview of how to get it running. Its not a trivial thing to do but this should give you some idea of how to approach the problem.

This widget could not be displayed.

@Adam Markham [Adaptavist] thank you!  I had the same idea, but was hoping that there is exist a more easy approach.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

189 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you