Get step properties in Python

I’m implementing a plugin in Python. I have a base test step class (not available to UI) where I defined some properties. I created a few test steps that inherit from the base test step thus get all the declared properties of the parent one. That works fine.

Now I’d like to make some adjustments to these properties in the __init__() of child steps, namely add attributes to them, e.g. set some of them to outputs.

Is there a way to access all declared properties of the parent class? I tried using self.GetType().GetProperties() but it seems it only shows built-in properties. I also checked various other methods and properties of the step but without luck.

1 Like

As an additional note, if I do something like self.prop = self.AddProperty("my_property", True, Boolean) in the parent step and then do something like self.prop.AddAttribute(OutputAttribute) it works fine, so my only issue is to extract all the properties from the step in a proper way rather than save them in the class data.

Hi @tatiana.boye,

unfortunately, the current version does not have that possibility. This is because the ‘self’ object is not exactly the same object as what you see in the test plan. The object in the test plan is a kind of a wrapper around your python test step object.

In the next version (Python 3.0), this will be a possibility as the object in the test plan is the same as the python object.


Thanks for the explanation @rolf_madsen. Will stick to the workaround while looking forward to the version 3.0.

1 Like