<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Execute Codesys Tests with python</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/</id><updated>2025-08-01T09:40:03.639000Z</updated><subtitle>Recent posts to Execute Codesys Tests with python</subtitle><entry><title>Execute Codesys Tests with python</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/?limit=25#da8e" rel="alternate"/><published>2025-08-01T09:40:03.639000Z</published><updated>2025-08-01T09:40:03.639000Z</updated><author><name>laurennjames10</name><uri>https://forge.codesys.com/u/laurennjames10/</uri></author><id>https://forge.codesys.com3fb49f19e8ae669a9341bdc5abcda66023ca4382</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I had a similar issue before, and in my case, it was resolved by ensuring the correct target device was selected and that the boot application was properly downloaded and set to start automatically. &lt;br/&gt;
&lt;a href="https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/"&gt;https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/&lt;/a&gt;&lt;a href="https://duck-life.io" rel="nofollow"&gt;duck life&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Execute Codesys Tests with python</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/?limit=25#0dbc/9cbe" rel="alternate"/><published>2025-07-24T06:50:37.667000Z</published><updated>2025-07-24T06:50:37.667000Z</updated><author><name>pouyavakili</name><uri>https://forge.codesys.com/u/pouyavakili/</uri></author><id>https://forge.codesys.come562c3ed98cf5d0f3f701bec07a92b7bb06cd455</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you for your input!&lt;/p&gt;
&lt;p&gt;What I'm ultimately trying to achieve is automated test execution as part of a CI/CD pipeline (e.g. in GitLab or Azure DevOps). For this, I need to:&lt;/p&gt;
&lt;p&gt;Open a CODESYS project via script&lt;/p&gt;
&lt;p&gt;Build the project&lt;/p&gt;
&lt;p&gt;Run the Test Manager tests from a .TestRepository.xml&lt;/p&gt;
&lt;p&gt;Collect test results (e.g., pass/fail + a report)&lt;/p&gt;
&lt;p&gt;Exit with a proper return code (for pipeline success/failure)&lt;/p&gt;
&lt;p&gt;To integrate this into automation, I’m using the CODESYS scripting engine via Python (headless), but the issue is that the get_testmanager() function isn't available on the project object — even though Test Manager is installed, licensed, and works interactively in the IDE.&lt;/p&gt;
&lt;p&gt;Are you suggesting that I should:&lt;/p&gt;
&lt;p&gt;Use the Test Manager GUI to script the logic with its internal scripting language?&lt;/p&gt;
&lt;p&gt;Or is there a way to launch the Test Manager in headless/scripted mode, while still being able to control things via Python?&lt;/p&gt;
&lt;p&gt;If there's a supported way to automate tests with the Test Manager using scripting, especially from pipelines or headless environments, I’d really appreciate any pointers or example workflows.&lt;/p&gt;
&lt;p&gt;Thanks again!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Execute Codesys Tests with python</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/?limit=25#0dbc" rel="alternate"/><published>2025-07-23T13:27:49.276000Z</published><updated>2025-07-23T13:27:49.276000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com7d1bc5319cb5de8524ff7a18107fa48287c341be</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If you want to use the Test Manager, I prefer to start all the tests through the scripts of this manager. So open from there the projects, load it and run it. If you also want to use Python scripts to access CODESYS functionality, while executing a Test Manager script, then also start them from the Test Manager commands.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Execute Codesys Tests with python</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fce611429a/?limit=25#00b2" rel="alternate"/><published>2025-07-23T12:42:05.586000Z</published><updated>2025-07-23T12:42:05.586000Z</updated><author><name>pouyavakili</name><uri>https://forge.codesys.com/u/pouyavakili/</uri></author><id>https://forge.codesys.comd854bb66430f6c90c9f620f9efc88dda6efb5337</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;❓ Issue: TestManager Not Available in Python Script (AttributeError)&lt;/p&gt;
&lt;p&gt;🙏 Question:&lt;br/&gt;
Why does project.get_testmanager() not work in scripting, even though Test Manager is installed and licensed, and the script runs in GUI mode?&lt;/p&gt;
&lt;p&gt;Is there a way to ensure the Test Manager interface is loaded or accessible from the scripting environment?&lt;/p&gt;
&lt;p&gt;🧠 Summary:&lt;br/&gt;
I'm trying to automate test execution using the CODESYS scripting engine (Python) via a script that opens a project, builds the application, and runs tests from a TestRepository.xml. Although the Test Manager works manually in the IDE, it fails when accessed via script with the following error:&lt;/p&gt;
&lt;p&gt;AttributeError: 'ScriptObject' object has no attribute 'testmanager'&lt;/p&gt;
&lt;p&gt;🧪 Test Setup:&lt;br/&gt;
CODESYS version: 3.5.21.10&lt;/p&gt;
&lt;p&gt;Test Manager: Installed and licensed (works in the IDE manually)&lt;/p&gt;
&lt;p&gt;Project: Contains a test repository, which can be executed via the GUI&lt;/p&gt;
&lt;p&gt;Script execution method:&lt;/p&gt;
&lt;p&gt;powershell&lt;br/&gt;
Start-Process -FilePath "C:\Program Files\CODESYS 3.5.21.10\CODESYS\Common\CODESYS.exe" `&lt;br/&gt;
  -ArgumentList @(&lt;br/&gt;
    '--profile="CODESYS V3.5 SP21 Patch 1"',&lt;br/&gt;
    '--runscript="C:\Scripts\run_tests.py"'&lt;br/&gt;
  ) -Wait&lt;/p&gt;
&lt;p&gt;📜 Script Summary:&lt;br/&gt;
python&lt;br/&gt;
project = projects.open(project_path)&lt;br/&gt;
application = project.active_application&lt;br/&gt;
application.build()&lt;/p&gt;
&lt;h1 id="this-fails"&gt;This fails:&lt;/h1&gt;
&lt;p&gt;testmanager = project.get_testmanager()&lt;br/&gt;
❗ Problem:&lt;br/&gt;
Calling project.get_testmanager() or application.testmanager throws an AttributeError, even though the same project and test repository work in the GUI.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>