Is it possible to run Java based test automation suite on Bitrise CI/CD?
Functionalities which I will be looking at: - Maven Runtime - String Parameters passing - Cucumber-JVM - Connectivity to Cloud devices provider like Browserstack(web) / Saucelabs(mobile)
Also, what kind of job will we need to set-up on Bitrise, for this purpose
Thanks
This can be achieved by using a Script step which calls a script inside your repository: (Path is relative to your repo)
Script Step:
#!/usr/bin/env bash
set -ex
bash ./scripts/bitrise/test_controller.sh
Inside the test_controller.sh
we have logic which controls the other bash scripts to execute (can use ruby as well), which will we will then run maven in:
test_controller.sh
#!/usr/bin/env bash
set -ex
if [[ "$SHOULD_RUN_SPECIFIC_TESTS" == "false" && "$SHOULD_RUN_RELEASE_TESTS" == "false" ]]; then
if [[ $BITRISE_TRIGGERED_WORKFLOW_TITLE == "iOS-Appium" ]]; then
echo "=> Executing run_develop_ios_tests.sh"
bash ./scripts/bitrise/ios/run_develop_ios_tests.sh
exit 0
elif [[ $BITRISE_TRIGGERED_WORKFLOW_TITLE == "Android-Appium" ]]; then
echo "=> Executing run_develop_android_tests.sh"
bash ./scripts/bitrise/android/run_develop_android_tests.sh
exit 0
fi
fi
If we don't want to run specific tests, and not release, and the workflow that triggered this run is iOS-Appium, then we run execute run_develop_ios_tests.sh
:
run_develop_ios_tests.sh
#!/usr/bin/env bash
set -ex
mvn clean test \
-DplatformName=IOS \
-Dsurefire.suiteXmlFiles="${XML_FILES}" \
-DIOS_DEVICE_NAME="${IOS_DEVICE_NAME}" \
-DIOS_PLATFORM_VERSION="${IOS_PLATFORM_VERSION}" \
-DSAUCE_USERNAME="${SAUCE_USERNAME}" \
-DSAUCE_ACCESS_KEY="${SAUCE_ACCESS_KEY}"
The logic inside the test controller, is driven by env variables -- and so are the string params which guide our mvn clean test
command.
Since we connect to SauceLabs remotely, we do not need any special agent for this. Just JDK and Maven, which are pre-installed.