Skip to content

[MOB-46781] Track and catch actionId for failed actions#1964

Merged
devership16 merged 5 commits intomasterfrom
MOB-44069_taurus_changes
Feb 27, 2026
Merged

[MOB-46781] Track and catch actionId for failed actions#1964
devership16 merged 5 commits intomasterfrom
MOB-44069_taurus_changes

Conversation

@devership16
Copy link
Collaborator

@devership16 devership16 commented Feb 26, 2026

Sample code Snippet:

    def _1_Scenario_Section_1(self):
        with apiritif.smart_transaction('Scenario Section 1'):
            try:
                self._current_actionId = '646e8b97-9409-476d-980d-741de9f3e418'
                action_start({'actionId': '646e8b97-9409-476d-980d-741de9f3e418', 'param': 'https://blazedemo.com/', 'selectors': [], 'tag': '', 'type': 'go', 'value': None})
                self._current_actionId = '646e8b97-9409-476d-980d-741de9f3e418'
                self.driver.get('https://blazedemo.com/')
                
                waiter()
                self._current_actionId = '646e8b97-9409-476d-980d-741de9f3e418'
                action_end({'actionId': '646e8b97-9409-476d-980d-741de9f3e418', 'param': 'https://blazedemo.com/', 'selectors': [], 'tag': '', 'type': 'go', 'value': None})
                self._current_actionId = '19f5bc8a-230c-4854-a24a-89edadc03d01'
                action_start({'actionId': '19f5bc8a-230c-4854-a24a-89edadc03d01', 'param': None, 'selectors': [{'XPath': '/html/body/div[3]/form/div/input'}], 'tag': '', 'type': 'click', 'value': None})
                self._current_actionId = '19f5bc8a-230c-4854-a24a-89edadc03d01'
                
                var_loc_keys = get_locator([{'XPath': '/html/body/div[3]/form/div/input'}])
                self.driver.find_element(
                var_loc_keys[0], 
                var_loc_keys[1]).click()
                waiter()
                self._current_actionId = '19f5bc8a-230c-4854-a24a-89edadc03d01'
                action_end({'actionId': '19f5bc8a-230c-4854-a24a-89edadc03d01', 'param': None, 'selectors': [{'XPath': '/html/body/div[3]/form/div/input'}], 'tag': '', 'type': 'click', 'value': None})
                self._current_actionId = '7aaf69d0-0585-4607-a21e-36bde33006bd'
                action_start({'actionId': '7aaf69d0-0585-4607-a21e-36bde33006bd', 'param': None, 'selectors': [{'XPath': '/html/body/div[2]/table/tbody/tr[5]/td[1]/input'}], 'tag': '', 'type': 'click', 'value': None})
                self._current_actionId = '7aaf69d0-0585-4607-a21e-36bde33006bd'
                
                var_loc_keys = get_locator([{'XPath': '/html/body/div[2]/table/tbody/tr[5]/td[1]/input'}])
                self.driver.find_element(
                var_loc_keys[0], 
                var_loc_keys[1]).click()
                waiter()
                self._current_actionId = '7aaf69d0-0585-4607-a21e-36bde33006bd'
                action_end({'actionId': '7aaf69d0-0585-4607-a21e-36bde33006bd', 'param': None, 'selectors': [{'XPath': '/html/body/div[2]/table/tbody/tr[5]/td[1]/input'}], 'tag': '', 'type': 'click', 'value': None})
                self._current_actionId = 'd00eb555-e714-48a1-b05f-9436a6faf2fd'
                action_start({'actionId': 'd00eb555-e714-48a1-b05f-9436a6faf2fd', 'param': 'Sample 123', 'selectors': [{'ID': 'address1111'}], 'tag': '', 'type': 'type', 'value': None})
                self._current_actionId = 'd00eb555-e714-48a1-b05f-9436a6faf2fd'
                
                var_loc_keys = get_locator([{'ID': 'address1111'}])
                self.driver.find_element(
                var_loc_keys[0], 
                var_loc_keys[1]).clear()
                self.driver.find_element(
                var_loc_keys[0], 
                var_loc_keys[1]).send_keys('Sample 123')
                waiter()
                self._current_actionId = 'd00eb555-e714-48a1-b05f-9436a6faf2fd'
                action_end({'actionId': 'd00eb555-e714-48a1-b05f-9436a6faf2fd', 'param': 'Sample 123', 'selectors': [{'ID': 'address1111'}], 'tag': '', 'type': 'type', 'value': None})
            except Exception as exc:
                raise type(exc)((((('actionId: ' + str(self._current_actionId)) + ' | ') + str(exc)) if (self._current_actionId is not None) else str(exc))) from exc

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds logic to capture and include actionId in error messages when test steps fail in Taurus. The implementation tracks the current actionId during test execution and wraps test methods with exception handlers that prefix the actionId to error messages, making it easier to identify which specific action failed during test execution.

Changes:

  • Added actionId tracking infrastructure with _current_actionId attribute and tracking methods
  • Implemented exception wrapping that includes actionId in error messages for failed actions
  • Added test to verify actionId exception handling behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
bzt/modules/_apiritif/generator.py Added actionId tracking methods, parsing logic, exception wrapping, and class setup modifications to support actionId capture in error messages
tests/unit/modules/_selenium/test_selenium_builder.py Added test case to verify that actionId tracking and exception wrapping is generated correctly in the output script

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.90%. Comparing base (e61b199) to head (5f3ccfa).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1964      +/-   ##
==========================================
- Coverage   89.91%   89.90%   -0.00%     
==========================================
  Files          71       71              
  Lines       20150    20179      +29     
==========================================
+ Hits        18115    18140      +25     
- Misses       2035     2039       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@devership16 devership16 changed the title Mob 44069 taurus changes [MOB-46781] Track and catch actionId for failed actions Feb 26, 2026
@devership16 devership16 merged commit 24fd648 into master Feb 27, 2026
3 checks passed
@devership16 devership16 deleted the MOB-44069_taurus_changes branch February 27, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants