Testcomplete as an IDE for software automation testing, with a small number of interfaces for different people to run projects in different scenarios, how do I start it and execute its project under Windows DOS?
Below is the command line provided by Testcomplete:
TestComplete.exe[file_name[/run
[(/project:Project_Name)|
(/project:Project_Name/projectitem:Item_name)|
(/project:Project_Name/test:test_name)|
(/project:Project_Name/unit:Unit_name/routine:Routine_name)]
[/exit]][/silentmode[/errorlog:file_name]][/exportlog:file_name]
[Timeout:Time_in_seconds] [/forceconversion][/ns]
The meaning of the above command is very clear, do not introduce the parameters inside ...
According to the above command, write a can specify time and test mode to execute the TC Project bat script, the general idea is: Use the set/p command to define a variable to receive input values, and then change the value of the current time compared with the date, the format of the agreed time, if the judgment is equal to execute, otherwise wait ~
The specific batch script is as follows:
@echo off@echo /**************** begin *************/::author Alan_Yset /p Executetime=please input the execution time (format:hhmm ,such as 1930): Set /p projectmodel=please input project model (1:testitems , 2:main):set tcexepath=e:\software\testcomplete10\testcomplete.exeif %projectmodel% equ 1 ( set projectpath= "E:\Learning\AutoTest\AutoTest.mds") else ( set projectpath= "E:\Learning \autotest\autotestsuit.pjs ") @echo. @echo testcomplete.exe path: %tcexepath% @echo. @echo project path: %projectpath% @echo. set /a timer=1set sign=::looprem get the current timeset currentTime=%time:~0,2%%time:~3,2%if %Timer% EQU 1 ( @echo the current Time: %currentTime:~0,2%%sign%%currentTime:~2,2% @echo the execute time: %executeTime:~0,2%%sign%%executeTime:~2,2% @echo.) else ( rem wait for 60s ping -n 60 127.0.0.1>nul 2 >nul @echo the current Time: %time:~0,2%%sign%%time:~3,2% @echo the execute time: %executetime:~0,2%%sign%%executetime:~2,2% @echo.) if %currenttime%==%executetime% ( rem kill tc process taskkill /f /IM "testcomplete*" rem run tc and execute project if % projectmodel% equ 1 ( start %tcexepath% /r /e %projectpath% ) else ( start %tcexepath% %projectpath% /r /p:autotest /t: "Script|fmain|main" ) else ( set /a timer=%timer%+1 goto loop) @echo /***************** end **************/
The effect of the operation is as follows:
/**************** begin *************/
Please input the execution time (FORMAT:HHMM, such as 1930): 1830
Please input the project model (1:testitems, 2:main): 2
TestComplete.exe Path:e:\software\testcomplete10\testcomplete.exe
Project path: "E:\Learning\AutoTest\AutoTest.mds"
The current time:15:35
The Execute time:18:30
The current time:15:36
The Execute time:18:30
The current time:15:37
The Execute time:18:30
...... Until the execution
This article is from the "alan_y (upspringing)" blog, so be sure to keep this source http://alany.blog.51cto.com/6125308/1672916
Batch script runs the Testcomplete project