java - Does something like assertHTMLEquals exist for unit testing -


in test check:

assertequals("<div class=\"action-button\" title=\"actionbutton\">"</div>", result); 

if changes html (result), putting there space, html still valid, test fail.

is there way compare 2 html pieces if equal html. asserthtmlequals


xml unit says 2 lines equal:

string1:

<ldapconfigurations> <ldap tenantid="" active="false"> </ldap> </ldapconfigurations> 

string2:

<ldapconfigurations> <ldapdd tenantid="" active="false"> </ldap> </ldapconfigurations> 

but not, can see. (see: ldapdd )

this won't work case, if html happens valid xml will. can use tool called xmlunit. it, can write assert method looks this:

public static void assertxmlequal(reader reader, string xml) {     try {         xmlassert.assertxmlequal(reader, new stringreader(xml));     } catch (exception ex) {         ex.printstacktrace();         xmlassert.fail();     } } 

if doesn't work you, maybe there's other tool out there meant html comparisons. , if doesn't work, may want end using library jtagsoup (or whatever) , comparing if fields parses equal.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -