Free Support Forum - aspose.com

Analyzing RTF for regression tests

I would like to analyze the RTF files for content and format in order to execute some regression tests.
For example, I concatenate RTF files and I have some examples with success (visually checked by a human)…
How to compare those files with the ones that were generated using a new version of Aspose.Words or were generated after a change in my code that concatenated the files?

@cpatricio76,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input documents.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

@tahir.manzoor

I believe I didn’t make myself clear in my first speach.

I would like to know if Aspose.Words could help me to create regression tests on my side. For example, how to compare a RTF file that I know it is correct with another one using a new version of Aspose.Words or other change in my code?

@cpatricio76

Thanks for sharing the detail. Please read following article about comparing document.
How to Compare Two Word Documents

Following code example shows how to test that Word documents are equal. Hope this helps you.

Document docA = new Document(dataDir + "TestFile.doc");
Document docB = new Document(dataDir + "TestFile - Copy.doc");
// DocA now contains changes as revisions. 
docA.Compare(docB, "user", DateTime.Now);
if (docA.Revisions.Count == 0)
    Console.WriteLine("Documents are equal");
else
    Console.WriteLine("Documents are not equal");