Ask a Question

TestComplete12: Excel sheet not found error when executing as batch

SOLVED
nounge
Occasional Contributor

TestComplete12: Excel sheet not found error when executing as batch

On TestComplete 9, I was using the Windows Task Scheduler to run a suite of (scripted) tests by command line execution every day. I also use Excel to parameterize input for the tests. This had been working fine.

 

Recently, I upgraded to TestComplete 12. I adjusted the execution command appropriately (executable path etc.). Now, when I execute the command through Task Scheduler or as a batch, the test suite fails to execute. Each and every test begins, reports an Excel sheet not found (when retrieving the parameterized input), then continues to the next test.

 

This process happens for the entire project suite instantly.

 

However, when I execute the exact same command by executing it through Windows Run program (instantaneous), it runs without any issues.

 

While I can still execute the test suite, the loss of autonomy is undesirable. Does anybody have any work around or solution to this issue? Is it simply a lacking feature (or rather loss of due to TestComplete 9's ability)? I would appreciate any help.

 

Here is the command I use:

 

"C:\SmartBear\TestComplete 12\Bin\TestComplete.exe" "<project suite path>.pjs" /r /p:<project>/exportLog:"<results export path>.mht" /e /SilentMode

 

Note: The original TestComple 9 command I used was the exact same-except for the executable path and /SilentMode. SilentMode was added to suppress the Save dialog that appears after exiting (new log reference - new feature from  9 to 12). I have tried all variations with/without /SilentMode and /e.

1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

Re: TestComplete12: Excel sheet not found error when executing as batch

I'm still thinking it's a permissions thing in some way...  Running it at the "Run" prompt in windows is running it using your user account.  Running it as a task in task scheduler or as a batch, potentially, may be using a different user account or privilege level or, if it's running as you, it MIGHT not be running with the most elevated privileges you have (admin).

 

Try in your task setting the security options to have it run as an administrator. I know it seems strange, but give it a shot and see if that works.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

10 REPLIES 10
tristaanogre
Community Hero

Re: TestComplete12: Excel sheet not found error when executing as batch

Here's my guess without knowing the specifics of your project or your environment.

Your excel sheet in TC is referenced using some sort of relative pathing. Because you are running the scripts now from a different executable path and, potentially, even a different project path, that relative pathing may not be pointing to your Excel sheet any more.

 

 

Here's another guess: the task scheduler I think has something like a "Start in" option?  Is it possible that, because of the change in executable path, that you've lost the relative pathing in that manner.  Check your start in on your task.

Either way, it seems to be a problem, not with TC 12, but with the scheduling of the task and the context in which the task is run.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
nounge
Occasional Contributor

Re: TestComplete12: Excel sheet not found error when executing as batch

I understand that you would believe the paths to be the issue due to the error message. I considered it as well. However, the paths are not declared relatively in the command. This is verified by the fact that the command works perfectly through a normal Command Prompt.

 

I am not using the Start in option. For the sake of simplifying the solution, we can neglect Task Scheduler. The command does not work when inserted into a batch call.

tristaanogre
Community Hero

Re: TestComplete12: Excel sheet not found error when executing as batch

Hrm... what about permissions elevation? Is it possible that when running as a batch/task that the persmissions aren't sufficient to get to the Excel sheet?

Could you post the code that is accessing your excel sheet or a screenshot showing the configuration if you have it in a Project variable or Keyword Test Variable?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
nounge
Occasional Contributor

Re: TestComplete12: Excel sheet not found error when executing as batch

I don't believe it to be a permissions issue: TestComplete 9 was able to access it this way. I will take a closer look at this, but I don't believe it is the cause.

 

Attaching the code for the GetParameters function

nounge
Occasional Contributor

Re: TestComplete12: Excel sheet not found error when executing as batch

FYI: code is VBScript

tristaanogre
Community Hero

Re: TestComplete12: Excel sheet not found error when executing as batch

OK... the code looks fine at first blush.

Two pieces of information that will be helpful:

1) The exact line of code generating the error

2) The exact text of the error message

 

I'm GUESSING it's on 

Set oWorkbook = oExcel.Workbooks.Open(...)

But your OP mentions Sheet not found, not file not found... which seems to point to the next line

Set oWorksheet = oWorkbook.Worksheets.item("Data")

Can you confirm what's happening?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
nounge
Occasional Contributor

Re: TestComplete12: Excel sheet not found error when executing as batch

Yes, it is on oWorkbook. I apologize for the confusion.

nounge
Occasional Contributor

Re: TestComplete12: Excel sheet not found error when executing as batch

Here is the error message.

I've looked into the 3 suggested problems but none seem likely in the slightest.

tristaanogre
Community Hero

Re: TestComplete12: Excel sheet not found error when executing as batch

I'm still thinking it's a permissions thing in some way...  Running it at the "Run" prompt in windows is running it using your user account.  Running it as a task in task scheduler or as a batch, potentially, may be using a different user account or privilege level or, if it's running as you, it MIGHT not be running with the most elevated privileges you have (admin).

 

Try in your task setting the security options to have it run as an administrator. I know it seems strange, but give it a shot and see if that works.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: