![](/img/trans.png)
[英]CANoe: How to select and start test cases from XML Test Module from Python using CANoe COM interface?
[英]CANoe test environment and test module Python
我正在嘗試通過它的名稱在 CANoe 中創建一個測試環境,但是如果該文件(name.tse)已經存在於我的 PC 中,我只想將它上傳到 CANoe 中。 之后,我想從我的PC上傳一個測試模塊(file.xml)到CANoe,然后上傳一個.can文件。
我從以下腳本開始,但我遇到了這些問題:
def AddTestEnvironment(self, TestEnvName):
self.TestSetup = self.App.Configuration.TestSetup
TEpath = self.get_path(TestEnvName)
if (TEpath == None):
print("The test environment doesn't exist we will create one")
testenv = self.TestSetup.TestEnvironments.Add(TestEnvName)
testeny = win32com.client.CastTo(testenv, "ITestEnvironment2")
test_module = testenv.Folders.Item("TestFolder")
else:
p = os.path.splitext(TEpath)[1]
pos.path.splitext (TEpath)[1]
if (p.lower() == '.tse'):
print ("The test environment path is:", TEpath)
print("The test environment already exists and it's path is:", TEpath)
testeny = self.TestSetup.TestEnvironments.Add(TEpath)
testenv=win32com.client.CastTo(testenv, "ITestEnvironment2")
我無法在獨木舟中添加測試模塊,這是我用來執行此操作的代碼
self.TestEnvs = self.App.Configuration.TestSetup.TestEnvironments TE1 = self.TestEnvs.Add("New Test Environment") TM = self.TestEnvs.TestEnvironment.AddTestModule(path)
當我運行時,出現此錯誤:文件“C:\Users\lenovo\Anaconda3\lib\site-packages\win32com\client_init _.py ”,第 473 行,在getattr raise AttributeError("'%s' object has沒有屬性 '%s'" % (repr(self), attr)) AttributeError: '<win32com.gen_py.CANoe 10.0 Type Library.ITestEnvironments instance at 0x2477275952408>' object has no attribute 'TestEnvironment'
我正在嘗試通過它的名稱在 CANoe 中創建一個測試環境,但是如果該文件(name.tse)已經存在於我的 PC 中,我只想將它上傳到 CANoe 中。 之后,我想從我的PC上傳一個測試模塊(file.xml)到CANoe,然后上傳一個.can文件。
我從以下腳本開始,但我遇到了這些問題:
def AddTestEnvironment(self, TestEnvName):
self.TestSetup = self.App.Configuration.TestSetup
TEpath = self.get_path(TestEnvName)
if (TEpath == None):
print("The test environment doesn't exist we will create one")
testenv = self.TestSetup.TestEnvironments.Add(TestEnvName)
testeny = win32com.client.CastTo(testenv, "ITestEnvironment2")
test_module = testenv.Folders.Item("TestFolder")
else:
p = os.path.splitext(TEpath)[1]
pos.path.splitext (TEpath)[1]
if (p.lower() == '.tse'):
print ("The test environment path is:", TEpath)
print("The test environment already exists and it's path is:", TEpath)
testeny = self.TestSetup.TestEnvironments.Add(TEpath)
testenv=win32com.client.CastTo(testenv, "ITestEnvironment2")
我無法在獨木舟中添加測試模塊,這是我用來執行此操作的代碼
self.TestEnvs = self.App.Configuration.TestSetup.TestEnvironments TE1 = self.TestEnvs.Add("New Test Environment") TM = self.TestEnvs.TestEnvironment.AddTestModule(path)
當我運行時,出現此錯誤:文件“C:\Users\lenovo\Anaconda3\lib\site-packages\win32com\client_init _.py ”,第 473 行,在getattr raise AttributeError("'%s' object has沒有屬性 '%s'" % (repr(self), attr)) AttributeError: '<win32com.gen_py.CANoe 10.0 Type Library.ITestEnvironments instance at 0x2477275952408>' object has no attribute 'TestEnvironment'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.