Forum Discussion

russelld's avatar
russelld
Contributor
2 years ago
Solved

Automate Test Cases using Task Scheduler

Hi,

 

I'm trying to automate my test cases using Windows Task Scheduler. The process executes and opens my desktop application but it don't recognize the Alias names that are mapped using Name mapping.  Is there an option I'm missing?

 

Thanks

Dave

  • As long as the mapping is unique, what you have now should be fine. If the object name changes, as it can on a web page, then you would use a wildcard to address it.

    https://support.smartbear.com/testcomplete/docs/reference/misc/using-wildcards.html

     

    If the object name is not changing, I would still look for a timing issue. Here are some things to try:

    • Do the Delay again, but put something really long like 2 minutes in the value.
    • Put a breakpoint before the line with the failure and step through to see what's happening in each step.
  • Hi,

     

    As Marsha wrote.

    Personally I don't like those Index, ObjectGroupId and other properties that you used to map the window. They seem to me to be not stable and thus I would try to find some set of unique and stable identifiers for mapped objects.

     

7 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    What's the exact error message that you're getting?

     

    Is the task scheduler running tests on the same machine where you run them directly from TestComplete?

    • russelld's avatar
      russelld
      Contributor

      Hi, 

      See attached for the error message within TC.

      Yes, task scheduler is trying to run tests on the same machine where I run them directly from TestComplete.

       

      Dave

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        My first guess is that it's a timing issue.  The test may be executing faster through the scheduler.  Try putting a long Delay before the first test line and right after it.  See if that helps find the first couple of objects properly. If that works, then are better ways to fix that for your whole test, like using Wait, or changing the whole test to have just a little more time between the execution of each line.  

         

        Let us know how the Delay works and we can help with the rest after that.

  • I tried adding a delay but now I think the issue lies within the name mapping for the window.

    It seems it work sporadically, sometimes it picks up when I run it and then it won't for me and using task scheduler. Just wondering if you can offer any suggestions as to setting up my map settings for the window?

    • Marsha_R's avatar
      Marsha_R
      Champion Level 3

      As long as the mapping is unique, what you have now should be fine. If the object name changes, as it can on a web page, then you would use a wildcard to address it.

      https://support.smartbear.com/testcomplete/docs/reference/misc/using-wildcards.html

       

      If the object name is not changing, I would still look for a timing issue. Here are some things to try:

      • Do the Delay again, but put something really long like 2 minutes in the value.
      • Put a breakpoint before the line with the failure and step through to see what's happening in each step.
      • russelld's avatar
        russelld
        Contributor

        Hi...

        Here's what I found...

        1. I resolved a minor issue with my name mapping

        2. I added a couple delays near the beginning of the Execution plan. I normally set my delays from 500 to 800. Using Task Scheduler I added a delay at the opening script of 15000 & when the program opened another delay of 20000.

        3. The user account setup to run the Automated task on our internal server needed access to the files being run. I logged into that generic account and ran the files needed and set the project suite as default for the Internal Server account.

        Done a test run overnight and it worked great!

         

        Thanks for the help!

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      As Marsha wrote.

      Personally I don't like those Index, ObjectGroupId and other properties that you used to map the window. They seem to me to be not stable and thus I would try to find some set of unique and stable identifiers for mapped objects.