Python or Jython script to change a value in XML file and update to a new value and use as data

ChinnuChinnu Posts: 5

My scenario:
I want to execute a query and get XML , store in output file, picked up in python and changing few values inside XML and again using it as data for subsequent story

Comments

  • benken_parasoftbenken_parasoft Posts: 1,025 ✭✭✭

    store in output file

    You typically use the Write File tool to write files. However, it is typical to store XML nodes in memory using an XML Data Bank. Subsequent tests can reference the node or nodes that you select in the XML Data Bank using a "custom column name" you also configure.

    picked up in python and changing few values inside XML

    Have you considered using the "Allow Alteration" option in the XML Data Bank or XML Transformer tool? This will allow you to modify text nodes in the document. You can change the value and can reference variables in the replacement value if needed. You can also setup an extraction on the root node if you need to extract the entire document with the alteration.

  • ChinnuChinnu Posts: 5

    ok thank you, How can i send customized python script for asserting date range calculations and time stamp?

  • benken_parasoftbenken_parasoft Posts: 1,025 ✭✭✭
    edited September 22

    How can i send customized python script for asserting date range calculations and time stamp?

    Use the XML Assertor. There are various built-in assertions available, including ones for Data/Time Range/Difference. If you need to script something custom then you can add the "Custom" assertion which allows you to provide a script.

Sign In or Register to comment.