Hi ash1,Does the scenario require that it be done with a Method Tool? Remember that you can use an XML Data Bank to write to a Writable Data Source. By default, if the element doesn't exist (is optional and not specified) then nothing will be sent to the Writable DS. When this is all done, then you can parametrize another test against the Writable DS.
from com.parasoft.api import *from java.lang import *def myFunc(input, context): runTest = context.getVariable("runTest") value = String(str(input)) if (not value.startsWith("XML input did not have XPath item")): runTest.setValue("True") return 1The runTest variable here is the boolean Test Suite Variable that you want to conditionally set. Note that this function always returns 1 - you will want to enable the "Return Value indicates success" checkbox, so that the XML Transformer doesn't cause the test to fail when the optional element is not found.