Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Call a testscript with python

Malcolm
2014-03-12
2014-03-12
  • Malcolm - 2014-03-12

    Hello,

    How can I call a testscript with python? I can open a testscript-xml with python but it doesn't run.

    Regards,
    Malcolm

     
  • mkeller - 2014-03-12

    Hi Malcolm.

    I'm not sure what you want to accomplish. If it is related to your previous post about a continuous loop inside a test script please give a short description what you want to test.

    The following combinations of scripting and Test Manager are possible:
    - Test script which executes Python code with the command ExecuteScript from TestManager.Scripting
    - Execute a Python script which starts a CODESYS instance with the required parameters for executing a test script
    - Execute the (menu) command "Execute Test Script" inside a Python script; requires access to the API of the Automation Platform

    I would take the first one and convert the test steps, which should run in a loop, to Python code with the loop around it.

    Rough example for a test script:
    - Prepare
    - Test
    - Clean up

    Regards,
    Martin

     
  • Malcolm - 2014-03-12

    Hi Martin,

    thanks for your answer. Yes, it is related to my previous post. I want to test e.g. set/clear I/Os.

    I have a test script which executes Python code with the command ExecuteScript from TestManager.Scripting. My Problem is how to execute in Python the test script which contains the I/O-Actions.

    Regards,
    Malcolm

     
  • mkeller - 2014-03-12

    Hi Malcom.

    Malcolm hat geschrieben:
    My Problem is how to execute in Python the test script which contains the I/O-Actions.

    You shouldn't execute a test script from the Python code of another test script. The normal use case would be to use Call or RemoteCall to execute the other test script and the test report of the other one is integrated in the original one. But you need a loop which is not implemented yet.

    Are you using the commands from TestManager.Monitoring in that test script? If yes, than you could do the same by using the scripting interface. See read_value(), set_prepared_value(), write_prepared_values() and other methods of the IScriptOnlineApplication.

    Regards,
    Martin

     
  • Malcolm - 2014-03-12

    Where can I find a list of all IScriptOnlineApplication methods?

    Regards,
    Malcolm

     
  • mkeller - 2014-03-12

    Hi Malcolm.

    The documentation is in the file "ScriptEngine.chm" in the sub directory "Online Help" of CODESYS. It's not linked to the online help which you can reach directly from CODESYS.

    The scripting interface is in the book "_3S.CoDeSys.ScriptEngine.BasicFunctionality Namespace".

    Regards,
    Martin

     

Log in to post a comment.