1
0
-1

Hi,

I'm building a unit test for a prefill service.

The default template code for the test has the following:

Document formXml = new XmlDoc(testParams['Test XML Data']).document

However, when I run the test the formXml is null.


Using logger I have verified that 'Test XML Data' exists, and have verified that 'new XmlDoc() exists.

I can also get text from the XmlDoc using 'new XmlDoc(testParams['Test XML Data']).getText("//xPathExpression")'

However, formXml is null.

I have also examined the XmlDoc class and the constructor and 'getDocument' methods appear to be correct.


Any thoughts about how to solve this problem?


Thanks

Mark

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Mark,

      is not formXml straightaway what you need ?

      String xml = testParams['Test XML Data'];
       XmlDoc formXml = new XmlDoc(xml)
       formXml.setText('/AvokaSmartForm/Applicant/Email', 'email@email.com')
       logger.info formXml 

      result:

      14:33:33,689 INFO  <?xml version="1.0" encoding="UTF-8"?><AvokaSmartForm>
          <Applicant>
              <FirstName/>
              <LastName/>
              <Email>email@email.com</Email>
              <Mobile/>
              <Address>
                  <Line1/>
                  <Line2/>
                  <State/>
                  <PostCode/>
              </Address>  
          </Applicant>
      </AvokaSmartForm>

      Otherwise maybe: AppDocUtils()

      KR,

      Julio.

        CommentAdd your comment...