TestExecute Asynchron action fail on VM
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TestExecute Asynchron action fail on VM
Running a DelphiScript test on TestComplete 14.30.3743.7 x64 is passing, while running the same script on TestExecute 14 and VM (Windows Server 2016 64-bit OS,16 GB RAM, 4 cores 2.10 GHz), test will failed with Asynchronous object call failed.
Any idea?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Without knowing what the code is, can't say for sure. Most likely, there's something different on the TestExecute VM that is not accounted for on the development machine, most likely something to do with timing where an object does not exist in time.
Please post the code where the error occured.
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the function. I don't think is something wrong with it, since on TestComplete is doing well.
function ExportDivision
begin
TerminateAction:=aRunAsyncAction(bExportaDiv, 2, '', false, ConfAc);
comboxFileNameExpDiv.SetFocus;
comboxFileNameExpDiv.keys(PathName);
bSaveExportFileDiv.keys(' ');
bConfirmYesReplaceFileDiv.keys(' '); --it will run this line and at the next line will fail
CheckAction(TerminateAction,true);
end;
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CheckAction is not a TestComplete function I recognize so I'm guessing it's something custom written by you or someone on your team. can you share that code? I'm guessing it's something in there that's causing the failure.
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is a function based on CallObjectMethodAsync TestComplete's method. But again, I don't see a reason to pass in TC and fail in TE.
function aRunAsyncAction(aMainWindow: oleobject; ContainerType: integer; aActionName: string,
var w: oleObject;
begin
case ContainerType of
0 : w:= Runner.CallObjectMethodAsync(aMainWindow.commandManager.Commands.Item[aActionName], 'Execute');
1 : w:= Runner.CallObjectMethodAsync(aMainWindow.stateCM.Commands.Item[aActionName], 'Execute');
2 : w:= Runner.CallObjectMethodAsync(aMainWindow, 'PerformClick');
3 : w:= Runner.CallObjectMethodAsync(aMainWindow, 'keys',' ');
4 : w:= Runner.CallObjectMethodAsync(aMainWindow, 'keys',aActionName);
5 : w:= Runner.CallObjectMethodAsync(aMainWindow, 'BringToFront');
6 : w:= Runner.CallObjectMethodAsync(aMainWindow, 'PerformClick',aActionName);//don't change it
end;
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is CheckAction function.
function CheckAction(aAction :oleobject, bWaitToFinish : boolean = false) :boolean;
begin
if aAction.Completed then begin
result := false;
exit;
end;
while ((not aAction.Completed) and (bWaitToFinish)) do BuiltIn.Delay(200);
result := true;
end;
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's not the CheckAction method... that's the one you said errors, right?
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK... so, my DelphiScript is a bit rusty these days... but your function for running an Asynchronus action doesn't appear to return anything. So, you're assigning that TerminateAction to the result of aRunAsynchAction which doesn't appear to return anything. So, you're then trying got check the result of something that is empty... at least that's how it reads to me. So, I'm actually surprised it runs at all.
However, I'm assuming that something is missing in the code you pasted here so my next suspicion is that something is happening out of time with regards to your Asynch calls. TestExecute tends to run things a LOT faster than TestComplete at times... so, you may be trying to check the result of an Asynchronous call that may already be gone and destroyed...
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In addition to everything written by Robert:
> function aRunAsyncAction [...]
In a most cases human user works synchronously. Likewise do most of tests.
Actions like PerformClick, Keys, BringToFront are also synchronous.
Most of scripting languages (including DelphiScript) are synchronous. (Funny case with Javascript : while it was created as asynchronous one, practically all test frameworks force it to synchronous mode 🙂 )
The primary reason for the .CallObjectMethodAsync() method in TestComplete is to handle cases when some object does not exit its event handler until this event is handled. E.g. when the modal window does not return control until it is closed, causing deadlock when been controlled by test automation software. .CallObjectMethodAsync() method is the only means in this case and this is practically the only case when it should be used.
So, unless you can provide a reason why you are trying to implement asynchronous code in synchronous environment I would recommend you to not use .CallObjectMethodAsync() method and replace it with regular synchronous calls.
/Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alex,
Unfortunately, TestComplete won't work without the asynchron method on that specific modal window. On the other hand TestExecute seems not to work with asynchron method for the same modal window. I should probably create different scripts for each testing tool, which if you ask me, is not reasonable.
PerformClick is synchronous for as long as a modal window will not follow, when the case is changing, and an asychron method has to be use.
However, I can understand Robert's explanation that TestExecute is faster than TestComplete at runtime, and this is a reason to "loose" the asynchron object.
It is nothing wrong with the asynchron method I've posted here, since is running for years with TestComplete, with the same script, and on the same desktop application-the trouble is, we've just moved to TestExecute where it seems to be a different environment, and will take a bit more to get familiar with its behavior.
