Extension tool not reading Java class file & populating the method defined in it

NitziNitzi Posts: 17

Hello,

I have written below java method to compare two xml ignoring element orders.

String expected = "FOOBAR";
String actual = "BARFOO";
Diff myDiff = DiffBuilder.compare(Input.fromString(expected))
.withTest(Input.fromString(actual))
.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndAllAttributes))
.checkForSimilar()
.build();
return myDiff.getDifferences();

It is successfully compiled & the class file is generated in the workspace in bin folder. Bin folder path & xmlunit jar is added to the tool properties as well in project build path.

Unfortunately, Extension tool is not reading this method & the problem is specific to code Diff/DiffBuilder . If I remove the Diff code & return any of the expected/actual variable it is working & reading the method.

Please help me know why parasoft extension tool not able to read method when this specific piece of code is present?

Thanks,
Nitin

Comments

  • NitziNitzi Posts: 17

    Updated method details:

    String expected = "FOOBAR";
    String actual = "BARFOO";
    Diff myDiff = DiffBuilder.compare(Input.fromString(expected))
    .withTest(Input.fromString(actual))
    .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndAllAttributes))
    .checkForSimilar()
    .build();
    return myDiff.getDifferences();

  • jakubiakjakubiak Posts: 212 ✭✭✭

    Your script needs to import the package(s) needed by DiffBuilder and any related classes. You need to add the jar file(s) that contain DiffBuilder and its related classes to the system properties preferences.

    However, if you simply want to compare two XML documents while ignoring order, you don't need an Extension Tool. You can add a Diff Tool, put it in XML mode, and in the Options tab choose to ignore element order.

  • NitziNitzi Posts: 17

    I did import the packages & added the jar files but it's still not reading the class. If I run it in Java Application mode I can see the results.

    Another thing about Diff tool there's no option to ignore element order & text. I am using Parasoft SOATEST 9.6.

    Can you share the screenshot pls?

  • benken_parasoftbenken_parasoft Posts: 341 ✭✭✭
    edited October 2017

    You should see an option for "Diff engine". Make sure XMLUnit is selected. Next, you should see an option for "Ignore element order". These options have existed since SOAtest 9.8.2. Release notes for 9.8.2 mention "Included a new XML diff engine that improves performance when performing comparisons of XML files."

Sign In or Register to comment.