How to generate template XML test data files - dn0000001/test-automation GitHub Wiki

The framework can generate template XML test data files for any domain object (or page object or any object that inherits from the DataPersistence class.) The following are the steps:

  1. Open any domain object class (or supported object class) in IntelliJ
  2. Beside the line you define the class name to the right, you will see an IntelliJ 'run' button. Click the 'run' which opens a menu. Choose Run from the menu that opens.
  3. The template XML will be output to the Run panel below. generate-template-data
  4. Copy the generated XML to your test data file (which will be loading into the matching domain object.)
<?xml version="1.0" encoding="UTF-8"?>

<robo-form-do>
  <useDynamicPage>false</useDynamicPage>
  <roboFormPage>
    <firstName>firstName</firstName>
    <lastName>lastName</lastName>
    <creditCard>
      <creditCardType>creditCardType</creditCardType>
      <credit-card-number>creditCardNumber</credit-card-number>
      <cardVerificationCode>cardVerificationCode</cardVerificationCode>
      <card-expiration-date>
        <month>month</month>
        <year>year</year>
      </card-expiration-date>
      <cardUserName>cardUserName</cardUserName>
      <creditCardTypeFake>creditCardTypeFake</creditCardTypeFake>
    </creditCard>
  </roboFormPage>
  <roboFormDynamicPage>
    <firstName>firstName</firstName>
    <lastName>lastName</lastName>
    <creditCard>
      <creditCardType>creditCardType</creditCardType>
      <credit-card-number>creditCardNumber</credit-card-number>
      <cardVerificationCode>cardVerificationCode</cardVerificationCode>
      <card-expiration-date>
        <month>month</month>
        <year>year</year>
      </card-expiration-date>
      <cardUserName>cardUserName</cardUserName>
    </creditCard>
  </roboFormDynamicPage>
</robo-form-do>

Note: There will be some extra information that needs to be removed. (The first line will be the java command IntelliJ uses to run the TestNG test. The end will contain the test results status information.)

  1. Modify to have the desired test data for the test
<?xml version="1.0" encoding="UTF-8"?>

<robo-form-do>
  <roboFormPage>
    <firstName>John</firstName>
    <lastName>Doe</lastName>
    <creditCard>
      <creditCardType>Visa</creditCardType>
      <credit-card-number>1000 1000 1000 1000</credit-card-number>
      <cardVerificationCode>911</cardVerificationCode>
      <card-expiration-date>
        <month>01</month>
        <year>2021</year>
      </card-expiration-date>
      <cardUserName>John Doe</cardUserName>
    </creditCard>
  </roboFormPage>
</robo-form-do>
⚠️ **GitHub.com Fallback** ⚠️