質問

I want to provide a diff report for a non regression test. Regression test is to compare HTML files and generate report about which files are same and which are not same.

I found one tool called "CS-HTMLDiff", in which I can compare Text or HTML files and generate report in html or in XML file. I was not able to use this tool since i want to perform this tests on ant build but this tool doesn't support command line functionality. (I didn't find any other way to run this tool from code or ant build as it doesn't support command line functionality)

Is there any other tool or java library which can compare html files and generate report? (It is better if its opensource)

I have already read some stackoverflow information but I didn't found any solution for my problem. A customizable diff tool that can produce report (in XML, HTML)

Thanks for your help

役に立ちましたか?

解決

You might try DaisyDiff, a Java library that diffs (compares) HTML files. It highlights added and removed words and annotates changes to the styling.
Either use commandline (see DaisyDiff examples) or java api. See Main Class and DaisyDiff Class to get you going.
Here is a blogpost (in german) with some snippet generating a html report.

EDIT after comment

To simply check if there are any differences and catch those files, you don't need any addons,
use something like :

<project>
<fileset dir="/path/to/folder1" includes="**/*.html" id="diff">
 <different targetdir="/path/to/folder2" ignoreFileTimes="true"/>
</fileset>

<pathconvert refid="diff" pathsep="${line.separator}" property="htmldiff"/>
<!-- if fileset diff is empty, ${htmldiff} and htmldiff.txt are also empty -->
<!-- echo to file, one file per line -->
<echo file="htmldiff.txt">${htmldiff}</echo>
</project>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top