Menu

compareElement checks the node name ?

2003-02-07
2003-02-19
  • Salim Djaffar

    Salim Djaffar - 2003-02-07

    I've been seeing that XMLUnit does not fail for the given scenario, such as two closely identical xml files are compared where one of them is a bad-form. 
    For example:
    <envelope01>....</envelope>
    and
    <envelope>....</envelope>

    Eventhough the junit swing passed the test, the error message was printed on the command line.

    Has it anything to do with junit ?

    Thanks.

     
    • Salim Djaffar

      Salim Djaffar - 2003-02-07

      I tried with this sample:

      String control = "<envelope><header><orig>1</orig></header><body>test</body></envelope>";
      String test = "<envelope0001><header><orig>1</orig></header><body>test</body></envelope>";
      xmlTestCase.assertXMLEqual(control, test);

      assertXMLEqual does not fail.
      Any hint ?

       
      • Jeff Martin

        Jeff Martin - 2003-02-07

        Sorry for the slow reply, I'm having one of those lives.

        Just tried this

            public void testBug() throws Exception{
                String control =       "<envelope><header><orig>1</orig></header><body>test</body></envelope>";
                String test = "<envelope0001><header><orig>1</orig></header><body>test</body></envelope>";
                assertXMLEqual(control, test);
            }

        and it fails quite happily.

        Not quite sure what your problem could be. Can you post the complete testsuite code?

         
    • Salim Djaffar

      Salim Djaffar - 2003-02-19

      The difference is I have the try-catch block instead of just throwing an exception in my test case.
      If I put the assertXMLEqual() inside the try-catch block, the swing junit will not display the failure whenever an exception is raised.
      I think I should follow your suggestion. Thanks.

       

Log in to post a comment.

MongoDB Logo MongoDB