[XML] Failed test cases now take precedence during submission #163
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In JUnit XML files where multiple test_case ids overlap, TestRail CLI currently reports both of them. This behavior results in only the last being "persisted" on the platform, which is especially problematic, when the first test_id fails and subsequent ones succeeds, as the platform now reports the test as being successful.
In instances where testcase ids collide, TestRail should opt for a pessimistic approach where the negative outcome takes the highest priority.
Issue being resolved: #161
Solution description
During upload,
data_provider/api_data_provider.py
now checks if another tests case is to be submitted with the samecase_id
, if not the test case is added to the list of `bodies.If the code encounters the same case id, one of two things happen:
This is a very simplistic approach that only takes the
failure
status code into account.Changes
A
takes_priority(self, statusId1, statusId2)
method has been added that returns true or false if the first statusId takes priority (is a failure):This method definitely leaves a lot to be desired, and it could be worth looking into creating a more sophisticated way of ordering the different status codes.
Appending a result body has been refactored and extracted to its own method:
append_result_body(self, bodies, case)
It is probably also worth noting that this implementation also does not take into account overlapping test_ids from different files.
Potential impacts
This change specifically impacts instances where JUnit xml files have repetitions of the same test_id. However, it should not have any impact on other instances.
All tests pass.
Steps to test
PR Tasks