Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automate message with Test execution content

Vojtech Kalab August 15, 2024 edited

Hello there,
I try to make autoamtion  sending messages to MS Teams webhook once test automation is created.
I would like to see test count, number of passed and failed test.

There is a documentation from Xray:

https://docs.getxray.app/display/XRAYCLOUD/Integration+with+Microsoft+Teams

 

However my messages are still without number regarding tests.
I don't know how to verify what is inside these variables like:

{{webResponse.body.data.getTestExecution.testRuns.results.status.name.match(".*(PASSED).*").size|0}}
I make script in python to see what is in response json:

{'data': {'getTestExecution': {'issueId': '1028525', 'jira': {'key': 'CTB-4977', 'customfield_10033': None}, 'testRuns': {'results': [{'status': {'name': 'PASSED'}, 'test': {'jira': {'key': 'CTB-4847'}}}, {'status': {'name': 'PASSED'}, 'test': {'jira': {'key': 'CTB-4848'}}}, {'status': {'name': 'PASSED'}, 'test': {'jira': {'key': 'CTB-4849'}}}, {'status': {'name': 'PASSED'}, 'test': {'jira': {'key': 'CTB-4873'}}}, {'status': {'name': 'PASSED'}, 'test': {'jira': {'key': 'CTB-4850'}}}, {'status': {'name': 'PASSED'}, 'test': {'jira': {'key': 'CTB-4615'}}}, {'status': {'name': 'PASSED'}, 'test': {'jira': {'key': 'CTB-4972'}}}, {'status': {'name': 'PASSED'}, 'test': {'jira': {'key': 'CTB-4678'}}}]}, 'testEnvironments': [], 'testPlans': {'results': []}}}}

 

Automation log also confirm all my posts were successful ( so token etc should be correct )

 

So question is if these variables are up to date in xray documentation?

How can i check what is inside these variables?

Or do you have any other idea how to get information like test count, passed and failed tests?

There is better structured json file:

 

 
json_data = '''{
    "data": {
        "getTestExecution": {
            "issueId": "1028525",
            "jira": {"key": "CTB-4977", "customfield_10033": None},
            "testRuns": {
                "results": [
                    {"status": {"name": "PASSED"}, "test": {"jira": {"key": "CTB-4847"}}},
                    {"status": {"name": "PASSED"}, "test": {"jira": {"key": "CTB-4848"}}},
                    {"status": {"name": "PASSED"}, "test": {"jira": {"key": "CTB-4849"}}},
                    {"status": {"name": "PASSED"}, "test": {"jira": {"key": "CTB-4873"}}},
                    {"status": {"name": "PASSED"}, "test": {"jira": {"key": "CTB-4850"}}},
                    {"status": {"name": "PASSED"}, "test": {"jira": {"key": "CTB-4615"}}},
                    {"status": {"name": "PASSED"}, "test": {"jira": {"key": "CTB-4972"}}},
                    {"status": {"name": "PASSED"}, "test": {"jira": {"key": "CTB-4678"}}}
                ]
            },
            "testEnvironments": [],
            "testPlans": {"results": []}
        }
    }
}'''

2 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 15, 2024

Hi @Vojtech Kalab -- Welcome to the Atlassian Community!

In your rule after the REST API call to get the test results from Xray, please try writing this to the audit log:

{{webResponse.body.data.getTestExecution.testRuns.results.status.name}}

That may confirm if the message is (or is not) being interpreted in a manner that can be parsed, or if it is plain text.

Kind regards,
Bill

Vojtech Kalab August 19, 2024

Hi Bill,
thank you for the kind welcome.

Thank you for your suggestion. It helped me to find out, my variables are empty, because i didn't check option:


Delay execution of subsequent rule actions until we've received a response for this web request

 

Thank you very much.

Like Bill Sheboy likes this
0 votes
Vojtech Kalab August 15, 2024 edited
 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events