Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Defect plugin : How to push the comment of a step to the defect



I am using the defect plugin to connect TestRail with Mantis.
The entered comment of the Test result is added to the default description.

I would like to also collect the actual result comments of the steps.
I don’t see any field related to the steps in the $context array

How can I retrieve this information ?



Hello Laurent,

Thanks for your posting. The steps are also part of the $context and can be accessed as follows:

(depending on the system name of your results field, in this case ‘step_results’)

Please note that the step results are JSON encoded and you need to decode this as follows:

$steps = json::decode($context['test_change']->custom_step_results); foreach ($steps as $step) { /* $step->index */ /* $step->content */ /* $step->expected */ /* $step->actual */ }

I hope this helps but please let me know in case you have any further questions.



Thank you for your help, it’s working fine :slight_smile:


That’s great, thanks for the confirmation!