Forum Discussion

SuperSingh's avatar
7 years ago

Is it possible to comment/uncomment a xml node via Groovy Script ?

I want one of the nodes in my xml to be commented based on some other input(input from excel say).

All I was looking for a piece which will do something like this.


if value =0 , comment  <node1>

if value=1, uncomment <node1>


Is it possible to do this via Groovy ? 

Any help or suggestions here will be greatly appreciated.





2 Replies

    • SuperSingh's avatar

      Here's the sample.

      Step 1 - This is a Groovy Step . Contains a script that will put values in Step 2 .

      Step 2 - This is a Request XML.

      Requirement : I want to control from Step 1 (using Groovy Script) , to comment the nodes in Step2.
      If my test requires to select CreditCard, I want to comment the nodes <debitCardNumber> and <debitCardType>.