Support AssertJ soft assertions (#19) #988
Open
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.
Context
Step tree
The first change is about processing step tree. If step fails its status should be escalated to all parent steps. (There is another way with substeps check for presence of at least one status differ from
PASSED
, but I preffered the mentioned above approach as more efficacious). This is achieved due to the following alghorythm:Ok, from now on any single failed step will be transformed to the real failed step branch. But do we have firm confidence that on each soft assertion error there is at least one failed step at the end of the step chain? Certainly we dont, I even found a case that confirms this.
The first failed step
To be sure in existence of at least one failed step which can trigger failed status propagating to all outer steps I added
advice
for setting callback viaDefaultAssertionErrorCollector.setAfterAssertionErrorCollected()
for each createdSoftAssertions
object.But there is a problem, because this method is absolutely ordinary setter. It means that its any following call will inevitably overwrite callback that was set before. Fortunately someone has already made corresponding pull request :)
Additionaly
Added pointcut that filters out nested step duplicates created by generated
.class
files method calls.Few words about tests
Extraordinary approach is used to avoid a lot of code duplicates and at the same time to cover all possible ways to create soft assertions objects.
Thank you for your attention!
Checklist