List of custom objects as a test step attribute, in Python

Is there a way to have a list of custom Python objects rather than built-in .NET objects as a property of a test step?

The following code from the examples works without an issue:
self.AddProperty("MyProperty", [1,2,3], List[Int32])

Whereas something along the following lines…
self.AddProperty("MyProperty", List[MyAwesomeClass](), List[MyAwesomeClass])

… seems to cause parsing error as it complains about ListMyAwesomeClass(

I guess that this limitation is caused by the fact the UI wouldn’t be able to handle a random MyAwesomeClass unless it implements methods for displaying etc. That said, is there any workaround / plan to support such use case?

1 Like

@pythonized you’ve identified the root problem. The UI needs to know how to render the classes. You are able to define Custom Control Providers and Attributes to tell the UI how to display your objects, although it works best as a C# extension:

1 Like

Thanks for the confirmation and heads-up @brennen_direnzo. I’m currently diving deeper into C# option and I feel like a healthy mixture of Python and C# code could be a good solution for those who generally prefer Python.

1 Like