Ask a Question

Parametrise xmlcheckpoint name

SOLVED
Petewilson
Contributor

Parametrise xmlcheckpoint name

 

Hi all,

 

I am looking to try and parameterise a function to check the xml generated against the baseline saved in TC.

i have simplified the code below, but my question is can i parameterise the actual checkpoint name, i.e. 'XML.XmlCheckpoint1' in the below? I can parameterise the actual xml source but i want to use this function multiple times in a loop, so want it to select the correct xml file from the Stores

 

XML.XmlCheckpoint1.Check(param1);

 

procedure XML_Compare;
var
  param1;
  param2;
begin
  param1 :=  'C:\\Work\\Data.xml';
  param2 := Project.Variables.Driver.value('XMLCheckpointName');
  XML.XmlCheckpoint1.Check(param1);
end;
2 REPLIES 2
tristaanogre
Esteemed Contributor

You're using DelphiScript so it's a bit trickier.  Basically, you're going to want to use the "Evaluate" function

 

Something like

 

Evaluate('XML.' + CheckpointName + '.Check(param1)')


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

Thank you Mysterious Gremlin Master  😉

 

DelphiScript is something i have inherited unfortunately, so thank you very much for your help.

 

That solved it for me.

cancel
Showing results for 
Search instead for 
Did you mean: