使用VBScript运行Canoe Test模块

时间:2018-09-06 08:03:31

标签: vbscript command-prompt canoe

TestModule.Stop()
While TMExecuting
   WScript.Sleep(200)
Wend

Sub TestModule_OnStop(reason)
TMExecuting = False
  Select Case (reason)
    Case 0
      MsgBox "Test module was executed completely."
    Case 1
      MsgBox "Test module was stopped by the user."
    Case 2
      MsgBox "Test module was stopped by measurement stop"
  End Select
End Sub

我尝试使用它在测试模块完成后停止测试模块,并使用 WHILE 循环启动第二个测试模块。但是在完成第一个测试模块后,我无法启动第二个测试模块。当我在文本文件中编写执行步骤时,我就知道了原因。

TestModule.Start()
    While (Not TMStarted)
        WScript.Sleep(200)
        LogFile.WriteLine "Test started"
    wend    

    While (TMExecuting)
        WScript.Sleep(500)
        LogFile.write("Value of TMExecuting is:" & TMExecuting)
        LogFile.WriteLine "CANoe test is running"
    Wend

在第一个测试模块TMExecuting完成之后,应该为

Sub TestModule_Onstop(reason)
  TMExecuting = False
  TMStarted   = False
  Select Case (reason)
    Case 0
      MsgBox "Test module was executed completely."
    Case 1
      MsgBox "Test module was stopped by the user."
    Case 2
      MsgBox "Test module was stopped by measurement stop"
  End Select
  LogFile.WriteLine " CANoe test is finished"
End Sub

但是由于第二个测试模块没有启动,它不会变为假。 如果有人有任何解决方案,请帮助。 我想使用VBScript在单个Canoe Configuration配置中运行多个测试模块和测试环境。

2 个答案:

答案 0 :(得分:0)

这就是我所做的。

Meas.Start()
stApp = True
While (Not MeasStarted)
    WScript.Sleep(500)
    'LogFile.WriteLine "Measurement not yet started"
Wend

While Counter <= 2
    Set TestModule = App.Configuration.TestSetup.TestEnvironments.Item(1).Items(Counter)

    WScript.ConnectObject TestModule, "TestModule_"

    TestModule.Start()
    While (Not TMStarted)
        WScript.Sleep(200)
        'LogFile.WriteLine "Test started"
    wend    

    While (TMExecuting)
        WScript.Sleep(500)
        'LogFile.WriteLine "CANoe test is running"
    Wend

    TestModule.Stop()
    Counter = Counter + 1
    'LogFile.write("The Current Value of the Counter is : " & Counter)
Wend

Meas.Stop()
    'LogFile.WriteLine "Request to stop the CANoe measurement"
    While MeasStarted
    WScript.Sleep(200)
Wend

App.quit
'LogFile.WriteLine "Request to close CANoe"
WScript.Sleep(200)
'LogFile.WriteLine "CANoe has been closed"
WScript.Sleep(200)

Sub Meas_OnStart()
  MeasStarted = True
  LogFile.WriteLine " CANoe measurement is running"
End Sub

Sub Meas_OnStop()
  MeasStarted = False
  LogFile.WriteLine " CANoe measurement is stopped"
End Sub

Sub TestModule_OnStart()    
  TMStarted = True
  TMExecuting = True
  LogFile.WriteLine " CANoe test is started"
End Sub

Sub TestModule_Onstop(reason)
  TMExecuting = False
  TMStarted   = False
  LogFile.WriteLine " CANoe test is finished"
End Sub

Sub App_OnQuit()
  stApp = False
  LogFile.WriteLine " Closing CANoe"
End Sub

这些步骤是在开放独木舟配置之后。

答案 1 :(得分:-2)

我想应该是

Sub TestModule_OnStop(reason)

大写字母S停在

VB区分大小写。