Zitat:
How can I set values for testing with a Test Manager Python script?
What do you mean?
If you want to set the value of a script variable you use an ASSIGNMENT. You can use it again if you want to change the value. For example, you want to call the same test script but with different values.
If you want to set the value of an IEC variable on the PLC, you have to use one of the commands from TestManager.Monitoring or use the Scripting API in a test action with the command ExecuteScript from TestManager.Scripting.
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your reply.
With the "CompareVariableList" I can compare more variables in one time. That gives a good overview.
And with the "WriteVariable" I can set one variable value. Is there a way to set more variable values with one command?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you are absolutely right. I forgot to look at the API documentation. If you can't be sure that all the variables contain only strings the "str()" is necessary.
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How can I set values for testing with a Test Manager Python script?
See the screen copy below this question.
The next software is used: Codesys V3.5 SP7 Patch 2 and Test Manager 4.0.1.1.
Hi Bakkertje.
What do you mean?
If you want to set the value of a script variable you use an ASSIGNMENT. You can use it again if you want to change the value. For example, you want to call the same test script but with different values.
If you want to set the value of an IEC variable on the PLC, you have to use one of the commands from TestManager.Monitoring or use the Scripting API in a test action with the command ExecuteScript from TestManager.Scripting.
BR
Martin
Hi Martin,
Thanks for your reply.
With the "CompareVariableList" I can compare more variables in one time. That gives a good overview.
And with the "WriteVariable" I can set one variable value. Is there a way to set more variable values with one command?
Hi Bakkertje.
You can use the Scripting API to prepare your values and send them to the PLC together. For example:
BR
Martin
Hi Martin,
Thanks, this is useful.
I only have to convert the value to s string type with str() and it works.
Hi Bakkertje,
you are absolutely right. I forgot to look at the API documentation. If you can't be sure that all the variables contain only strings the "str()" is necessary.
BR
Martin