Is there a way to safely abort from a step’s initialization function (specifically in Python), and not add the step to the test plan?
I have tried calling :
and raising errors. All of these are able to stop the step from being added, but the editor crashes shortly after.
I can also simply return from the init function, but this results in the step being added still.
Hi @rolf_madsen , yes - I wanted to block the user from adding the test step when the appropriate resources are not found in the bench settings.
Specifically, I was originally trying to create a robust way for a number of test steps to always use the correct resources.
For example, if a user is trying to run a certain test, but forgot to change the bench settings profile before adding the step, I’d like to stop the step from being added. Otherwise, an error would be generated due to failure to set a resource (if there are none of the desired resource), or the test might run incorrectly due to multiple steps using different resources (if there are too many of the desired resource).
There are a number of other ways I could try to enforce correct bench settings, but I was wondering if there was a clean way of stopping the step from being added in the first place.
Instead of trying to block the user from creating the test step I suggest you use validation rules to notify the user that the test step has been configured incorrectly.
If you make these kinds of constraints too rigid it might have unintended consequences for example when trying to load the test plan or work together with other plugins.
In general, it is good to be a bit tolerant with the settings - the users might do things in a different order than what you expect. But as long as the end result is the same, it should not matter.