A. Introduction
Momentum Suite Automate provides a good experience for those who want to integrate the existing test suite with CI/CD life cycle. Maintain quality and find problems as you develop. Continuous testing with Jenkins ensures your app works after every check-in and build, enabling you to find issues earlier by running tests automatically with each build.
B. Configuration
1. Login to Momentum Suite Automate and go to the Project page.
2. Choose your Momentum Suite Automate project.
3. Go to the “Test Runs” tab on the top menu and click “Create a New Test“.
4. Select your test cases to run. After that select your device(s).
5. When you go back to the “All Test Runs” screen, you will see an option as “GET CI URL“. Click it.
6. You can copy the Hook URL to use it in your CI tool.
https://api.momentumsuite.com/api/testPlans/run/YOUR-RUN-ID
Sample POST request to trigger URL in your CI tool:
The first URL is your CI URL which is generated from the momentumsuite.com project’s test run.
appPath is your path to APK, IPA, or website
hookUrl is your Jenkins hook URL. It will be triggered automatically after TestRun has been finished on MomentumSuite.
auth is your Jenkins Token
SAMPLE REQUEST
curl --location --request POST 'https://api.momentumsuite.com/api/testPlans/run/YOUR-RUN-ID' \
--header 'Content-Type: application/json' \
--data-raw '{
"hookUrl": "",
"auth": ""
}'
RESPONSE
{
"error": false,
"message": "OK",
"result": {
"callbackUrl": "https://api.momentumsuite.com/api/testRuns/testResult/YOUR_ID",
"resultUrl": "https://console.momentumsuite.com/en/report/YOUR_ID"
},
"statusCode": 200,
"errorCode": 0
Get Test Results in JSON or XML
(GET) JSON TestResult (Junit)
(GET) XML TestResult
Sample Patch Request
{
"status": "inProgress",
"variables": {
"junit.test.result.url": {
"value": "https://api.momentumsuite.com/api/testRuns/testResult/YOUR-RUN-ID"
}
}
}
callbackUrl=$(curl --location --request POST 'https://api.momentumsuite.com/api/testPlans/run/YOUR-RUN-ID' \
--header 'Content-Type: application/json' \
--data-raw '{"hookUrl": "","auth": ""}' \
| jq --raw-output '.result.callbackUrl')
replaceWithString="testResultXml"
xmlCallbackUrl="${callbackUrl/testResult/$replaceWithString}"
fileName=$(cut -d/ -f7 <<<"${callbackUrl}")
sleep 20
curl ${xmlCallbackUrl} > "test-results.xml"
TEST RESULTS ON JENKINS