Running Tests via the Jenkins Plugin UI

Last modified on May 26, 2023

This guide contains instructions for using the BitBar Run-in-Cloud plugin from the UI. For instructions on Pipeline, see Running Tests With a Pipeline Script.

Configure

Open the Jenkins main configuration page (Manage Jenkins > Configure System) in the BitBar Run-in-Cloud section and fill in the necessary BitBar Testing account information. Click the Authorize & Save button to validate account details.

BitBar Run-in-Cloud configurations

Click the image to enlarge it.

Run-in-Cloud - Build Step

Open an existing Jenkins job or create a new one. From the job configuration, add a new build step.

To run tests in BitBar Cloud, select a target project, upload a new application or/and instrumentation package to that project, and define the file name in the corresponding field. If you need to customize project settings, click the Edit project on BitBar Testing website button, and it will open Cloud.

Jenkings plugin - Build step

Click the image to enlarge it.

Annotations can be configured in the following section. For more information on how to use annotations to execute subsets of tests, see Using annotations.

Jenkings plugin - Build step

Click the image to enlarge it.

The following fields are only for Android Instrumentation runs:

  • Device group

  • Device language

  • Screenshots configuration

  • Custom test runner

  • Tests with annotation

  • Tests without annotation

  • Use test cases from

API call

Jenkins is pulling BitBar Testing for results. The test results are copied to the Jenkins workspace after the tests are finished.

API call

Click the image to enlarge it.

Hook URL

BitBar Testing sends a post message to a defined URL when a test run is finished. RiC listens to the message in the default location and downloads results when the post message arrives. The listened URL can be changed.

A POST message body:

testRunId=%s&projectId=%s&status=FINISHED

This requires HOOK URL to be reachable from the Internet, i.e., the Jenkins instance can be reached from BitBar Testing.
Hook URL

Click the image to enlarge it.

Using annotations

Android InstrumentationTestRunner allows you to filter test runs from a specific Java package or class, but in addition, you can also use custom Java annotations in your test methods to filter the tests runs.

Create custom annotations

All you have to do is to create a class like this:

package com.testdroid.test.annotations;
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyAnnotation {
}

Then, annotate your test method:

@MyAnnotation
publicvoid testButtonClick() throws Exception {
    /*
    test code
    */
}

When running your tests in BitBar Testing, open the run’s Advanced options > Test case options and define your annotation class in the Test cases with specific annotations.

Tests are then executed including or excluding the given annotation used in configurations.

Annotations can be mixed with a package or a class. Those settings are also available from BitBar Testing Run in the Cloud plugin with Jenkins.

Example

Here is an example Eclipse project with annotations in use.

See Also

Jenkins Run-in-Cloud Plugin
Integrations

Highlight search results