[python] Accessing attributes and verdict of test plan reference

I have a test plan consisting of a sequence of test plan references. I would like to access the test plan references’ name, verdict and perhaps start time. If possible, I’d prefer to access the test plan references from another test step.

As far as I can tell it isn’t publishing any results when I add the CSVResultListener as a resource, but perhaps they can still be accessed.

Any help to how this can be done is highly appreciated.

Hi @jb111,

The CSVResultListener only becomes active when actual results are published, so if only start/completed events gets registered not much will happen.

If you make another implementation of result listener you can record the data you are interested in.

How do you want to process the data?

Alright I think I understand.

My intentions are to record each verdict, name and timestamp for processing through e.g. a dictionary or similar. Finally, the plan is to create a document (.pdf or .docx) with a table containing the result of each test plan reference per row.

I’ve resolved my issue.
I couldn’t find any documentation on available attributes of test steps and test plans when using a ResultListener, so instead I listed all the objects’ attributes to get an idea.

From there I found the attributes that I needed in my case (luckily they existed) and could proceed from there.

In python it looks like this:

def OnTestPlanRunCompleted(self, planRun, logStream):
        """Handle test plan completion event."""
       attrs = dir(planRun)
       for attr in attrs:
              print(f"Attribute: {attr}")

and similarly for OnTestStepCompleted