可以利用任何計劃程序來(lái)啟動(dòng)并傳遞合適的命令行參數給TestComplete。例如,可以利用windows的任務(wù)計劃來(lái)定時(shí)啟動(dòng)TC并執行測試腳本。
任務(wù)計劃制定步驟
1、 在控制面板打開(kāi)任務(wù)計劃
2、 添加一個(gè)任務(wù)計劃
3、 選擇TestComplete作為運行應用程序
4、 在高級屬性設置中,指定如下命令行參數:
<TC安裝路徑>\Bin\TestComplete.exe <項目文件的路徑>/r /e
或者:
<TC安裝路徑>\Bin\TestComplete.exe <project suite的路徑>/r /e
TC的退出代碼
如果你想知道測試腳本運行是否成功,TestComplete提供如下表所列的退出代碼,用于報告上一次測試的結果:
Exit Code Description
0 上次測試沒(méi)有產(chǎn)生錯誤或警告
1 上次測試結果出現警告但沒(méi)有錯誤
2 上次測試結果出現錯誤
3 由于出現錯誤導致腳本無(wú)法運行,典型錯誤可能是測試組套的某個(gè)腳本程序不存在
可以在批處理文件中使用TC的這些退出代碼,例如:
REM Clears the screen
CLS
@ECHO OFF
REM Launches TestComplete,
REM executes the specified project
REM and closes TestComplete when the run is over
START \W C:\TestCompleteFolder\Bin\TestComplete.exe /r /e C:\TestCompleteFolder\Projects\MyProj\MyProj.mds
IF ERRORLEVEL 3 GOTO CannotRun
IF ERRORLEVEL 2 GOTO Errors
IF ERRORLEVEL 1 GOTO Warnings
IF ERRORLEVEL 0 GOTO Success
CannotRun
ECHO The script cannot be run
GOTO End
:Errors
ECHO There are errors
GOTO End
:Warnings
ECHO There are warnings
GOTO End
:Success
ECHO No errors
GOTO End
:End
文章來(lái)源于領(lǐng)測軟件測試網(wǎng) http://kjueaiud.com/