Forum Discussion

monil_thakker's avatar
monil_thakker
New Contributor
7 years ago

Parametrizing baseline XML name stored in Stores > XML using XML checkpoint

I am using XML checkpoint and my baseline XML is stored in Stores-XML. ;I have more than 1 baseline XML. I am using the command XML.MyBaselineXML1.Check(Actual_XML_Name)&This works good if I hard-code 'XML.MyBaselineXML1' name in the function. However, I want to call my function several times for different baseline reports. I tried creating a parameter for the baseline report name, something like this:

XML.MyBaselineXML1.Check(Actual_XML_Name). I want to parameterize MyBaselineXML1 items in stores-XML.

I read your solution for File checkpoint by using following but this is NOT an option for XML.

{

Set Stored File = Files.Items("Order List_old")If Not Stored File.Check("C:\Work\Orders List.text")

}

  • monil_thakker's avatar
    monil_thakker
    7 years ago

    Thank you so much Martin for your reply. I am using VB scripting. The curly braces was to give example of file checkpoint used in smart bear web so i just paste it to give ref. Please do not consider this question relating to Java or Java scripting.

    Could you please elaborate on "Eval" option which can used in this case and help with an example.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    What scripting language are you using for your code?  You're using a "Set" command... but you're also warpping it in curly braces like JavaScript....  So, hard to know.

    If you're using JScript or JavaScript, you can write your code like so

    function checkXML(xmlCheckpointName, xmlfilename){
    
    
        XML[xmlCheckpointName].Check(xmlfilename);
    
    }

    JScript and JavaScript and their implementation in TestComplete allow you to interchange between dot and bracket notation for objects.  So, you can leverage that as I did above to get to the particular child object of the XML based upon the string.

    If you're using VBScript, you should use "Eval" and structure the string of "Eval" to use your checkpoint name.

    • monil_thakker's avatar
      monil_thakker
      New Contributor

      Thank you so much Martin for your reply. I am using VB scripting. The curly braces was to give example of file checkpoint used in smart bear web so i just paste it to give ref. Please do not consider this question relating to Java or Java scripting.

      Could you please elaborate on "Eval" option which can used in this case and help with an example.