Test step attributes available in ResultListener?

As I understand test step attributes (e.g. Unit) are not available to result listeners (in TestStepRun). Is this correct or have I missed something?

I believe attributes are available anywhere in OpenTAP. Specifically for your example though, I have been able to use the unit attribute in a ResultsListener. In the example shown below, I’ve just attached a random unit attribute to one of the variables in the example results listener in %TAP_PATH%\Packages\SDK\Examples:


Thanks, but I was referring to the OnTeStepRunCompleted method in the result listener implementation. Its TestStepRun argument doesnt seem to contain the attributes from the calling test step? Perhaps the idea is to publish attributes (e.g. unit) in the results table?

I understand now. There are ways to retrieve the information inside an attribute: Retrieving Information Stored in Attributes | Microsoft Docs, and from there you could pass those values into Results.PublishTable(), but I don’t think there is a built in variable that stores this data.

@brennen_direnzo Do you have any experience with this?

I extended ResultSource.Publish, so it accepts more than just a name and value. Like @GoranJohnsson, I had a couple other pieces of metadata I wanted, like the units. So the extension combines the name and metadata into a formatted string, and calls Publish with that. Then my custom Result Listeners call a method to parse out the name and metadata.

any chance you have published that work somewhere? I am currently in the same need of some more advanced ways of publishing test results.

2 Likes

Hi @andries, it’s not published publicly, sorry. I haven’t yet delved into open-sourcing our code outside of the company.

@connospp brought up a similar issue, and I commented here:

2 Likes