cancel
Showing results for 
Search instead for 
Did you mean: 

Create XMLCheckpoint object at runtime for XML comparison

SOLVED
Highlighted
New Contributor

Create XMLCheckpoint object at runtime for XML comparison

I am creatng XMLCheckpoint at run time. I am adding numerous checkoints based on the XML files we get from log.

Checkpoints are created successfully however while comparison i need to pass Checkpoint name to XML object. Since at run time I am picking up the Checkpoint name, it is in String. I know that once i try XML.Checkpoint  (Object.String) it will not work.

Is there any way it can work ? Is there any concept of reflection where i can create object from the String ?

Please see the code below and the comment marked as '//' where i am getting stuck.

 

Code Snipet - 

 

Public Function testFn()

 

Dim XMLCheckpointNew, XMLOptions, XMLUpDoc, CheckPoint
CheckPoint = "XMLCheckPoint"


'Obtains the XMLCheckpoint object
Set XMLCheckpointNew = XML.CheckPoint  //It fails here since Checkpoint is String and it is not recognizing this as an object


'Obtains the XMLCheckpointOptions object
Set XMLOptions = XMLCheckpointNew.Options

 

'Enables the ExtendedLogging XML checkpoint option
XMLOptions.ExtendedLogging = True


'Specifies the XML document path
XMLUpDoc = "C:\ABCD\Test.xml"

'Compares MyXMLCheckpoint with the XML document
XMLCheckpointNew.Compare(XMLUpDoc)

End Function

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Create XMLCheckpoint object at runtime for XML comparison

There is no "checkpoint" property of the XML object... so, you can't just call XML.CheckPoint.  

 

You will need to use Eval to do what you want.

 

Set XMLCheckpointNew = Eval("XML." & CheckPoint)

Robert Martin
[Community Expert Group]
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
Extensions available
2 REPLIES 2
Community Hero

Re: Create XMLCheckpoint object at runtime for XML comparison

There is no "checkpoint" property of the XML object... so, you can't just call XML.CheckPoint.  

 

You will need to use Eval to do what you want.

 

Set XMLCheckpointNew = Eval("XML." & CheckPoint)

Robert Martin
[Community Expert Group]
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
Extensions available
New Contributor

Re: Create XMLCheckpoint object at runtime for XML comparison

Thanks 

This solution worked. Eventually I ended up doing the same as well.

Appreciate your timley correct response.

New Here?
Join us and watch the welcome video: