Forum Discussion

GradelinkQA's avatar
GradelinkQA
New Contributor
2 years ago

Test Plan not executing when using Command Line and Windows Task Scheduler

Hello,

Let me start by defining what it is I actually want to achieve: in a nutshell, all I need to be able to do is automatically run specific test cases through TestComplete on a weekly basis. I am currently attempting to accomplish that by using the Windows Task Scheduler to run a BAT file that opens TestComplete via the Command Prompt and includes several command line parameters. Just to clarify that last point, the command line parameters are included as part of the BAT file, NOT as part of the Scheduled Task.

According to Windows Task Scheduler, this task is being executed normally. However, there are several things I've noticed that indicate to me that TestComplete is not actually executing any test cases:

  • First, according to the History in the Windows Task Scheduler, the entire task completes in less than one second; I know from experience that running all of the test cases manually takes over an hour.
  • Second, there are no log files in TestComplete that correspond to when the Scheduled Task is supposed to run.
  • Third, I have a SQL database that stores data which should be affected when the test cases are executed. This database is updated 100% of the time when the test cases are executed manually, but there's no sign whatsoever that it has been touched since I created the Scheduled Task.

What is interesting is if I execute the BAT file manually (i.e. if I click on it with my cursor) TestComplete opens and runs the test cases normally. So something fishy is going on when the Task Scheduler actually tries to perform the task.

Now, you may be wondering why I'm opening TestComplete through a BAT file instead of pointing the Windows Task Scheduler itself directly at the TestComplete executable. I tried that first since it seemed like the more elegant solution and ran into a roadblock where the Task Scheduler was throwing a variety of error messages indicating TestComplete couldn't even be opened. If this method is the preferred one for executing test cases through TestComplete using the Windows Task Scheduler I can attempt it again and create a separate ticket documenting the error messages I encounter (if it happens again).

Below I've included screenshots including the actual BAT file itself as well as how I've configured the Schedule Task. I would appreciate any advice for how I can set this up to work correctly because I really have no clue where to start.

 

Content of the BAT file

 

Windows Task Scheduler - Edit Action

 

Windows Task Scheduler - Actions

 

 

5 Replies

    • GradelinkQA's avatar
      GradelinkQA
      New Contributor

      Hi Marsha,

      When I updated the Scheduled Task to run the TestComplete executable directly, as opposed to running the prepared BAT file, and then tried to manually trigger the Scheduled Task to see if it was working I immediately ran into several errors. I've tried searching for that error code online and haven't really found an answer as to what it represents; any additional input there?

      Windows Task Scheduler - History

       

      History - Error Message Details

       

      If it matters, the account I'm using ("davidb") IS already setup as an Administrator account on the machine I'm using.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Are you running this batch file against a local machine or remote machine?

     

    In your batch file, remove start cmd.exe /c and just use "C:\Program Files (x86)\SmartBear\TestComplete 14\x64\Bin\TestComplete.exe" with your parameters. 

     

    To test, from the Command Prompt (not your Desktop), are you able to open C:\Users\davidb\Desktop\TestCompleteAutomation.bat and does TestComplete run your project? If yes, then are you able to Run your Task Schedule (right click and select Run) that you have setup?

     

     

    • GradelinkQA's avatar
      GradelinkQA
      New Contributor

      Hi rraghvani,

      I attempted to follow your recommendation of altering the batch file slightly and after removing "start cmd.exe /c" and removing one pair of quotation marks (in my original post, you can see that I had two sets of quotation marks around the filepath), I was able to get the results I was looking for when manually triggering the Scheduled Task (i.e., TestComplete opened and started performing the test cases I had set in the execution plan). I'm going to let the Task Scheduler run 'naturally' to verify that everything works when I'm not manually triggering it, but what I've seen so far looks very promising.

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    Have you tried running through Test execute instead of Test complete?