Recording keyword test and making it work on another workstation
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Recording keyword test and making it work on another workstation
For example, the Run menu is positioned differently in 2003 than in xp. I have to edit the most parts of the keyword test for windows xp. The value for opening window differs as well. and i have to edit it again in xp. Windows look slightly different in xp.
Is there a way to make a simple test in 2003 and make it work on another different OS such as XP?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rachelle,
The behavior you observe means that your test uses unreliable properties for objects identification. You need to examine the problematic parts of your test and improve the test's reliability. For example, I strongly recommend that you start the tested application from TestComplete using the Tested Applications feature, since launching tested applications via the Start menu is the most unreliable way to launch applications in TestComplete tests, actually.
Best regards,
Alexey
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I am missing some feature to make it work please do tell me.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rachelle,
You can simply invoke the needed command directly from TestComplete, unless you need to test how Windows Explorer works (I suppose this is not the case). Please see the following How To entry to learn how to execute a command line and get the executed application's exit code from TestComplete:
http://www.automatedqa.com/support/viewarticle.aspx?aid=8966
The sample script executes the "notepad" command, which launches Notepad, but you can simply replace the corresponding string with any other command you need.
If you need to specify a file in a standard save/open file dialog invoked from your tested application, I recommend that you see the "Working With Open File and Save File Dialogs" ( http://www.automatedqa.com/support/viewarticle.aspx?aid=8006 ) help topic - it describes how the task can be accomplished in a reliable way.
Best regards,
Alexey
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not much knowledgeable in scripting but I'll definitely try that.
I have another question, I created a keyword test in win2003 server and copied my .mds file to another win2003 server with Testcomplete installed. But when I run the keyword test it fails. When I check my objects in keyword test for example
Aliases.rundll32.dlgMyApplication.btnOK
and choose highlight, it says that object does not exist and then I re-select the object using the Finder tool , same value of the object is listed
Aliases.rundll32.dlgMyApplication.btnOK
and then it works.
I am just wondering why is that I have to re-select almost everything when they have the exact same object values for the other PC to recognize it even with same OS. Is there any way to resolve this so that everytime another user gets the mds file from the other PC he does not need to re-highlight or edit the test just to make it run on his pc.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rachelle,
Please note that you need to copy the entire project suite folder, not just a single .mds file, in order to copy your project to another machine. So, the behavior can be caused by the fact that an old Name Mapping scheme is used. If all the needed files are copied, there are no obvious reasons which may cause such behavior. If copying the entire folder does not help, try the following:
1. Insert the following routine call before retrieving the problematic object in your test (change the process name):
LogAppStructure(Sys.Process("MyProcessName"))
Here is the LogAppStructure routine code:
Sub LogAppStructure(obj)
Err.Clear
On Error Resume Next
Dim count, i, Str
ReDim params(7)
params(0) = "WndClass"
params(1) = "WndCaption"
params(2) = "Index"
params(3) = "Visible"
params(4) = "Exists"
params(5) = "ClrFullClassName"
params(6) = "ProductName"
params(7) = "ProductVersion"
Str = ""
For i = 0 To UBound(params)
If IsSupported(obj, params(i)) Then
Str = Str & params(i) & " = " & VarToStr(Eval("obj." & params(i))) & VbCrLf
End If
Next
Call Log.AppendFolder(obj.Name, Str)
For i = 0 To obj.ChildCount - 1
Call LogAppStructure(obj.Child(i))
Next
Log.PopLogFolder
On Error GoTo 0
End Sub
function LogAppStructure(obj)
{
var count, i, Str;
var params = new Array();
params.push("WndClass");
params.push("WndCaption");
params.push("Index");
params.push("VisibleOnScreen");
params.push("Exists");
params.push("Visible");
params.push("FullName");
params.push("ClrFullClassName");
Str = "";
for (var i = 0; i < params.length; i++) {
if (IsSupported(obj, params))
Str += params + " = " + VarToStr(eval("obj." + params)) + "\r\n";
}
Log.AppendFolder(obj.Name, Str);
for (var i = 0; i < obj.ChildCount; i++) {
LogAppStructure(obj.Child(i));
}
Log.PopLogFolder();
}
2. Execute your test and reproduce the "Object not found" problem. The LogAppStructure function will post the entire structure of the tested application to the test log and you will be able to see how objects are recognized right before the problem occurs.
3. If you fail to find the cause of the problem using the test log, zip your entire TestComplete project suite folder along with the log of the test execution and send me the archive via our Contact Support form (http://www.automatedqa.com/support/message). Make sure that messages in your log correspond to correct actions in the latest version of your test.
Best regards,
Alexey
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where do I put that code? I tried adding it but it's not recognized as a valid routine? I will try copying the whole project folder, I think I am getting to understand what you mean with using the old name mapping and know why it doesn't work on some PCs or if I copy a Keyword test on another project. Is it because the name mapping present on the other project is not the same with the other project I am probably working at? Is that right? Please do correct me if I am wrong with my assumptions 🙂
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rachelle,
I tried adding it but it's not recognized as a valid routine?
You need to have a script file which contains the routine's body ("Sub LogAppStructure(obj)...") in your project. When the file is added, you will be able to call the routine.
Is it because the name mapping present on the other project is not the same with the other project I am probably working at? Is that right?
Yes, that can be the cause of the problem. Note that the behavior of your tests depends heavily on the project's Name Mapping scheme and the project's settings. That is why, you need to copy the entire project folder instead of just a single test file on another machine.
Best regards,
Alexey
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
