cancel
Showing results for 
Search instead for 
Did you mean: 

Running tests from TestExecute using batch file

SOLVED
Highlighted
Frequent Contributor

Running tests from TestExecute using batch file

Hi!

I created some smoke tests for our desktop application using TestComplete. I want to integrate these tests with TeamCity as part of continuous integration. I created a batch file which will run my tests using TestExecute silently. When I run my tests from TestComplete manually by right clicking the project suite and selecting "run focussed item", it runs perfectly without any issue. However, my batch file is not running the same way. When I run the batch file by double clicking, it opens a cmd window. After this, sometimes it runs all the tests, sometimes, it runs a few tests and sometimes it does not run any test. In the cmd window, it simply jumps from one test to the next without running them. I do get the "TestExecute has started" pop-up on the bottom right corner at the start of every test though. Attaching below a sample of my batch file and cmd image. Also, attaching screenshot of my TestComplete project with smoke tests. Please advise if I am doing something wrong or any suggestions. Thank you!

 

Batch file:
title Register 360 Smoke Tests
cd C:\svn\TestComplete\Batch_File
echo on

echo ***Starting Register 360 Smoke Tests...***

:: Running smoke tests now

"C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe" "C:\svn\TestComplete\DataPrepNew\DPSmokeTest\Reg360\Reg360.mds" /run /project:Reg360 /test:"Smoke Tests|Clean up" /ErrorLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsErrorLog /exit /SilentMode /ExportLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTests_log.html /ExportSummary:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsSummary /Timeout:3600

 

"C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe" "C:\svn\TestComplete\DataPrepNew\DPSmokeTest\Reg360\Reg360.mds" /run /project:Reg360 /test:"Smoke Tests|SmokeTest01TransgasE57import" /ErrorLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsErrorLog /exit /SilentMode /ExportLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTests_log.html /ExportSummary:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsSummary /Timeout:3600

 

echo ***Finished running Register 360 Smoke Tests...***

pause

 

I already tried:

1. Running the batch file as admin

2. Adding delays between the tests

 

Regards,
Sameer

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Contributor

Re: Running tests from TestExecute using batch file

Thanks, Alex. I will try what you suggested with the additional quotes. I was able to solve the issue by calling the tasskill command between my tests to force close the TestExecute.exe application. It is probably not a very graceful solution but it is working for now. I will try with additional quotes too.

 

Regards,

Sameer

View solution in original post

4 REPLIES 4
Highlighted
Community Hero

Re: Running tests from TestExecute using batch file

Hi,

 

I think that the problem is that calls for TestExecute follow one after another. The case is that by default command processor does not wait for the external command/application to complete and proceeds further. TestExecute and TestComplete are a single-instance applications, so they fail to start if already running.

Try to add 'start /wait' before calls to TestExecute and check if this helps.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Frequent Contributor

Re: Running tests from TestExecute using batch file

Hi Alex,

 

Thank you for your reply. I tried using start /wait at the start of my command (sample attached below). When I run the batch file, it launches TestComplete and then nothing happens; it does not run the tests. Maybe because of '/wait'? Am I using the command correctly?

 

If I launch TestExecute and then right click the TE icon on bottom right corner and select Run>'myProject' (i.e. without a batch file), it runs my tests ok. Only when I run the batch file, I am running into the issue.

 

start /wait "C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe" "C:\svn\TestComplete\DataPrepNew\DPSmokeTest\Reg360\Reg360.mds" /run /project:Reg360 /test:"Smoke Tests|Clean up" /ErrorLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsErrorLog /exit /SilentMode /ExportLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTests_log.html /ExportSummary:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsSummary /Timeout:3600

 

start /wait "C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe" "C:\svn\TestComplete\DataPrepNew\DPSmokeTest\Reg360\Reg360.mds" /run /project:Reg360 /test:"Smoke Tests|SmokeTest01TransgasE57import" /ErrorLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsErrorLog /exit /SilentMode /ExportLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTests_log.html /ExportSummary:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsSummary /Timeout:3600

 

Regards,

Sameer

Highlighted
Community Hero

Re: Running tests from TestExecute using batch file

Hi Sameer,

 

> When I run the batch file, it launches TestComplete and then nothing happens; it does not run the tests.

Yes, indeed, it looks like everything after /wait must be one command. And this command will be parsed later by separate copy of command processor.

To get the above, your command line must be additionally quoted with proper number of quotes to met parsing rules. Try to surround the command in the batch file with additional quotes and check command processor's output to set quotes properly.

You may try to start with the line like this:

start /wait """C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe" "C:\svn\TestComplete\DataPrepNew\DPSmokeTest\Reg360\Reg360.mds" /run /project:Reg360 /test:"Smoke Tests|Clean up" /ErrorLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsErrorLog /exit /SilentMode /ExportLog:C:\Reg360_smoke_tests\Export_Logs\SmokeTests_log.html /ExportSummary:C:\Reg360_smoke_tests\Export_Logs\SmokeTestsSummary /Timeout:3600""

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Frequent Contributor

Re: Running tests from TestExecute using batch file

Thanks, Alex. I will try what you suggested with the additional quotes. I was able to solve the issue by calling the tasskill command between my tests to force close the TestExecute.exe application. It is probably not a very graceful solution but it is working for now. I will try with additional quotes too.

 

Regards,

Sameer

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors