winIDEA SDK
Loading...
Searching...
No Matches
test_get_active_stub.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
import isystem.connect as ic
# This is an example how to crash winIDEA. Sample might be wrong, as it
# was a work in progress, but winIDEA shouldn't crash anyway.
winidea_id = ''
def test_getActiveStub():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
execCtrl = ic.CExecutionController(connMgr)
session = ic.CSessionCtrl(connMgr)
session.begin_program()
execCtrl.runUntilFunction('main') # make sure stack is initialized
execCtrl.waitUntilStopped()
tcCtrl = ic.CTestCaseController(connMgr, "getNumber", "")
tcCtrl.createParameter(0, "x")
print("Creating stub ...")
tcCtrl.createStub('timesTwo')
tcCtrl.init()
tcCtrl.run()
tcCtrl.waitUntilStopped()
tcStatus = tcCtrl.getStatus()
print(f"Current test case state: {ic.CTestCaseController.testState2str(tcStatus)}")
if tcStatus == ic.IConnectTest.stateStub:
print(f"Active stub name: {tcCtrl.getActiveStub().getStubName()}")
else:
print("No active stub...")
tcCtrl.run()
tcCtrl.waitUntilStopped()
tcCtrl.destroy()
if __name__ == "__main__":
test_getActiveStub()