Bamboo Integration

Bamboo is a continuous-integration, deployment, and delivery tool from Atlassian that integrates incredibly well with Jira.

Zephyr Scale's Bamboo integration enables you to automate tests outside Jira, run them in Bamboo during the CI/CD pipeline, and have results sent back to Zephyr Scale for reporting and tracking.

Before You Test: Set Global Variables

To initiate the Zephyr Scale integration with Bamboo, an admin must navigate to Bamboo's Global Variables and set variable names and values for both jira_user and jira_password.

64107f16b58bc.png

Before You Test: Download Feature Files

Prior to executing tests, Cucumber users with Gherkin definitions in Zephyr Scale should create a script task and add the following code to enable feature files to be downloaded from Zephyr Scale. When you add the code, replace the PROJECT_KEY and JIRA_URL variables with your actual information. Optionally, you can replace the TARGET_PATH, ZIP_FILE, and AUTO_CREATE_TEST_CASES variables with your information, as well.

Windows users:

@echo off
set USER=%bamboo_jira_user%
set PASSWORD=%bamboo_jira_password%
set BUILD_DIR=%bamboo.build.working.directory%
set TARGET_PATH=src\test\resources\features
set ZIP_FILE=bddfile.zip

set PROJECT_KEY=WEB
set JIRA_URL=http://localhost:2990

echo Clean target path
if exist "%BUILD_DIR%\%TARGET_PATH%" rmdir /s /q "%BUILD_DIR%\%TARGET_PATH%"
mkdir "%BUILD_DIR%\%TARGET_PATH%"

echo Downloading feature files
curl -u %USER%:%PASSWORD% %JIRA_URL%/jira/rest/atm/1.0/automation/testcases?tql="testCase.projectKey='%PROJECT_KEY%'" --output "%BUILD_DIR%\%TARGET_PATH%\%ZIP_FILE%"

echo Unzipping feature files
7z e -aoa "%BUILD_DIR%\%TARGET_PATH%\%ZIP_FILE%" -o"%BUILD_DIR%\%TARGET_PATH%"

echo Finished

UNIX Users:

USER=$bamboo_jira_user
PASSWORD=$bamboo_jira_password
BUILD_DIR="${bamboo.build.working.directory}"
TARGET_PATH="src/test/resources/features"
ZIP_FILE="bddfile.zip"

JIRA_URL="http://localhost:2990"
PROJECT_KEY="WEB"

echo "Clean target path"
rm -rf $BUILD_DIR/$TARGET_PATH
mkdir -p $BUILD_DIR/$TARGET_PATH

echo "Downloading feature files"
curl -u $USER:$PASSWORD $JIRA_URL/jira/rest/atm/1.0/automation/testcases?tql="testCase.projectKey='$PROJECT_KEY'" --output $BUILD_DIR/$TARGET_PATH/$ZIP_FILE

echo "Unzipping feature files"
unzip $BUILD_DIR/$TARGET_PATH/$ZIP_FILE -d $BUILD_DIR/$TARGET_PATH
echo "Finished"

Send Test Results from Bamboo to Zephyr Scale

To transfer your test-execution results from Bamboo back to Zephyr Scale, you need to create a final script task in the job where you want to report the test results.

Depending on if you use Cucumber or JUnit, add one of the following code sets, and remember to replace the PROJECT_KEY and JIRA_URL variables with your actual information. Optionally, you can replace the PATH_FILE, ZIP_FILE, and AUTO_CREATE_TEST_CASES variables with your information, as well.

When executed properly, the script runs after the testing concludes. Regardless of whether the tests pass or fail, the build completes, and the test results are published to Zephyr Scale.

Windows users:

set USER=%BAMBOO_jira_user%
set PASSWORD=%BAMBOO_jira_password%
set BUILD_DIR=${bamboo.build.working.directory}
set FILE_PATH="target/cucumber/*.json"
set ZIP_FILE="test_result.zip"
set AUTO_CREATE_TEST_CASES="true"


set PROJECT_KEY="WEB"
set JIRA_URL="http://localhost:2990"

echo "Removing old zip files"
rm -f %BUILD_DIR%/%ZIP_FILE%

echo "Creating new zip file"
7z a %BUILD_DIR%/%ZIP_FILE% %BUILD_DIR%/%FILE_PATH%

echo "Sending zip file to Zephyr Scale"
curl --basic --user %USER%:%PASSWORD% -F "file=@%BUILD_DIR%/%ZIP_FILE%;type=application/x-zip-compressed" %JIRA_URL%/jira/rest/atm/1.0/automation/execution/cucumber/%PROJECT_KEY%?=autoCreateTestCases=%AUTO_CREATE_TEST_CASES% -v

echo "Finished"

Windows users:

@echo off
set USER=%bamboo_jira_user%
set PASSWORD=%bamboo_jira_password%
set BUILD_DIR=%bamboo.build.working.directory%
set ZIP_FILE=test_result.zip
set AUTO_CREATE_TEST_CASES=true

set PROJECT_KEY=WEB
set JIRA_URL=http://localhost:2990

echo Removing old zip files
if exist "%BUILD_DIR%\%ZIP_FILE%" del /F /Q "%BUILD_DIR%\%ZIP_FILE%"

echo Creating new zip file
7z a "%BUILD_DIR%\%ZIP_FILE%" "%BUILD_DIR%\test_result.json"

echo Sending zip file to Zephyr Scale
curl --basic --user %USER%:%PASSWORD% -F "file=@%BUILD_DIR%\%ZIP_FILE%;type=application/x-zip-compressed" %JIRA_URL%/jira/rest/atm/1.0/automation/execution/%PROJECT_KEY%?autoCreateTestCases=%AUTO_CREATE_TEST_CASES% -v

echo Finished

UNIX users:

USER=$bamboo_jira_user
PASSWORD=$bamboo_jira_password
BUILD_DIR="${bamboo.build.working.directory}"
PATH_FILE="target/cucumber/*.json"
ZIP_FILE="test_result.zip"
AUTO_CREATE_TEST_CASES="true"

JIRA_URL="http://localhost:2990"
PROJECT_KEY="WEB"

echo "Removing old zip files"
rm -f $BUILD_DIR/$ZIP_FILE

echo "Creating new zip file"
zip $BUILD_DIR/$ZIP_FILE $BUILD_DIR/$PATH_FILE -j

echo "Sending zip file to Zephyr Scale"
curl --basic --user $USER:$PASSWORD -F "file=@$BUILD_DIR/$ZIP_FILE;type=application/x-zip-compressed" $JIRA_URL/jira/rest/atm/1.0/automation/execution/cucumber/$PROJECT_KEY?autoCreateTestCases=$AUTO_CREATE_TEST_CASES  -v

echo "Finished"

UNIX users:

USER=$bamboo_jira_user
PASSWORD=$bamboo_jira_password
BUILD_DIR=${bamboo.build.working.directory}
ZIP_FILE="test_result.zip"
AUTO_CREATE_TEST_CASES="true"

PROJECT_KEY="WEB"
JIRA_URL="http://localhost:2990"

echo "Removing old zip files"
rm -f $BUILD_DIR/$ZIP_FILE

echo "Sending zip file to Zephyr Scale"
zip $BUILD_DIR/$ZIP_FILE $BUILD_DIR/test_result.json -j

echo "Sending zip file to Zephyr Scale"
curl --basic --user $USER:$PASSWORD -F "file=@$BUILD_DIR/$ZIP_FILE;type=application/x-zip-compressed" $JIRA_URL/jira/rest/atm/1.0/automation/execution/$PROJECT_KEY?autoCreateTestCases=$AUTO_CREATE_TEST_CASES -v

echo "Finished"

Applying Scripts in Bamboo

This task describes how to apply scripts in Bamboo for the Zephyr Scale integration.

  1. Navigate to your Bamboo project.

  2. Select the plan you want to configure.

  3. On the Actions menu in the upper-right corner, click Configurations.

  4. On the Tasks tab, click Add Task.

  5. Search for and select the Script task type.

    64107f1859db7.png
  6. Update the field values in the Script Configuration section, as shown.

    Task descriptions will vary.

    For Windows:

    64107f198d6d3.png

    For Linux:

    64107f1abbdc0.png
  7. Paste the script into the script body.

    64107f1be6588.png
  8. Drag the script task into the desired position.

    To transfer your test-execution results from Bamboo back to Zephyr Scale, you need to drag the script into the Final Tasks section.

    64107f1d8869c.png

Annotations for JUnit and Cucumber Tests

Learn more about JUnit annotations and Cucumber annotations.

Publication date: