TestComplete Evaluate Statement function equivalent
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2010
10:53 PM
03-15-2010
10:53 PM
TestComplete Evaluate Statement function equivalent
Does TestComplete have an Evaluate function equivalent?
What I'm trying to do is build a string then execute it as a function call.
So for example, if I have a function called "Start_Application" which takes two parameters, path and mode, I've built a string that looks like this
FunctionCall = "Start_Application" & "(" & Path & "," & Mode & ")"
Then I want to run:
Set Err = Evaluate(FunctionCall) which would be the equivalent of doing Set Err = Start_Application("C:\Test.exe",0)
Is there a way to do this?
What I'm trying to do is build a string then execute it as a function call.
So for example, if I have a function called "Start_Application" which takes two parameters, path and mode, I've built a string that looks like this
FunctionCall = "Start_Application" & "(" & Path & "," & Mode & ")"
Then I want to run:
Set Err = Evaluate(FunctionCall) which would be the equivalent of doing Set Err = Start_Application("C:\Test.exe",0)
Is there a way to do this?
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2010
12:48 AM
03-16-2010
12:48 AM
Yes, TestComplete has an evaluate function. In fact, I use it frequently. My code example below is DelphiScript but it should give you an idea of the capability.
Now, I don't think you can use Evaluate to evaluate a function, only an object. However, if you want do do a function call, you can do something like this.
Hope this helps!
P.S. Hi, gang! I'm back... been away too long...
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
Document := Sys.OleObject(XML_DOM_OBJECT);
Document.Load(BaselineDirectory + EVENT_TICKET_HOLD_BASELINE + VarToStr(Self.MessageID) + '.xml');
Log.Message(BaselineDirectory + EVENT_TICKET_HOLD_BASELINE + VarToStr(Self.MessageID) + '.xml loaded.');
//Create object for result
Log.Message('Attempting to create XML node: ' + MESSAGE_EVENT_TICKET_HOLD + VarToStr(Self.MessageID));
XML.CreateXML(MESSAGE_EVENT_TICKET_HOLD + VarToStr(Self.MessageID), Document);
//Compare! Easy peasy.
Comparison := Evaluate('XML.' + MESSAGE_EVENT_TICKET_HOLD + VarToStr(Self.MessageID));
Comparison.Options.IgnoreNodeOrder := True;
Comparison.Compare(Response.DOMObject);
Now, I don't think you can use Evaluate to evaluate a function, only an object. However, if you want do do a function call, you can do something like this.
Result := ODT.Classes.New('eGalaxyMessage');
Result := Runner.CallMethod('ODT' + aMessageType + 'Message.AddObjectSpecificProperties', Result);
Hope this helps!
P.S. Hi, gang! I'm back... been away too long...
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
03-16-2010
01:26 AM
03-16-2010
01:26 AM
Hi,
Use the Eval or Execute function to do this. These functions are standard VBScript functions.
In general, TC doesn't have a special function for this, but you can use native functions of the scripting language you are using.
Jared
Use the Eval or Execute function to do this. These functions are standard VBScript functions.
In general, TC doesn't have a special function for this, but you can use native functions of the scripting language you are using.
Jared
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
