Contact details:
mail: hakkuss@yahoo.com
Find me on linkedin.
Description:
This tool is able to find differences between different versions of the same document
based on the mapping file that can be automatically edited. It is useful when testing
an application that generates files like contracts and one might be interested that
the file generation process remains stable between releases.
Supported file extensions:
PDF,
DOC,
DOCX,
TXT
How to:
Make sure you have JDK(from 1.5 and above) installed.
Windows:
-
Generate the template
a) Edit the following line from "generateTemplate.vbs" with the actual file name:
Dim filename : filename = "<fileName>.pdf"b) Execute "generateTemplate.vbs", it will automatically generate the ".template.txt" file with the text content from the pdf file.
-
Create the map file
a) Create the .map.txt
b) Define keys for each dinamically changed string values from the pdf file. -dinamically changed values are those that vary in different versions of the ".pdf" file.
for example company name, dates, any other identifiable changeable elements that may appear replace the changeable values inside the "<fileName>.template.txt" file with the related keysExample of map file:
<key_CompanyName>:_:ENTCS <key_MyUserName>:_:myuserid@mydept.myinst.myedu <key_CoUserName>:_:couserid@codept.coinst.coedu -
When the map file is ready and the values in the template file are replaced with the keys the tool is ready to validate any documents of the same type.
-
Compare files
a) Edit the following lines from "compareByTemplate.vbs" with the actual file name of the fail to be compared and the file names for the map and template file.
Dim fileName : fileName = "<fileToCompareWith>.pdf" Dim templateName : templateName = "<fileName>.template.txt" Dim mapName : mapName = "<fileName>.map.txt"b) execute "compareByTemplate.vbs", it will automatically display a message box with the differences or "No data found!" if the files are identical.
Note: the differences would be available in: "ComparisonDetailsLog.txt"
Console:
-
Generate the template
a) Edit the in the command below and execute it cmd:
java -cp Comparator-0.0.1-jar-with-dependencies.jar document.comparator.MainApp -type generate_template -doc1 <fileName>.pdfb) Execute the command in cmd, it will automatically generate the ".template.txt" file with the text content from the pdf file.
-
Create the map file
a) Create the .map.txt
b) Define keys for each dynamically changed string values from the pdf file. -dynamically changed values are those that vary in different versions of the ".pdf" file.
for example company name, dates, any other identifiable changeable elements that may appear replace the changeable values inside the "<fileName>.template.txt" file with the related keys -
When the map file is ready and the values in the template file are replaced with the keys the tool is ready to validate any documents of the same type.
-
Compare files
a) Edit the and the in the command below:
java -cp Comparator-0.0.1-jar-with-dependencies.jar document.comparator.MainApp -type template -doc1 <fileToCompareWith>.pdf -tmpl <fileName>.template.txt -map <fileName>.map.txtb) execute "compareByTemplate.vbs", it will automatically display a message box with the differences or "No data found!" if the files are identical.
Note: the differences would be available in: "ComparisonDetailsLog.txt"