🖋️
QualityMate
  • QualityMate
  • Getting Started
    • Introduction
    • Why QualityMate
    • Architecture
    • Supported Web Browsers
    • Glossary
  • Components
    • UI Player
      • Basic Concepts
      • UiPlayer
      • MSTest Integration
      • Samples
        • QualityMate Sample Desktop
        • QualityMate Sample Web
        • QualityMate MSTest Integration Sample Desktop
        • QualityMate MSTest Integration Sample Web
        • QualityMate Integration with Test Frameworks
        • Web Authentication Sample
      • QualityMate Project Template
    • UI Recorder
      • Basic Concepts
      • Setting Up the Recorder
      • Validating an Element
      • Generating QualityMate Solution
  • Tools
    • File Comparators
    • Image Processor
    • Project Merger
    • Test Case Generator
      • Filters
      • Rename Recorded Controls
  • Basic Concepts
    • Page Object
      • Work Guide
    • Controls
      • Control Types
        • Generic Types
        • Desktop types
        • Web Types
        • WebMap types
          • Kendo PowerBuilder
          • Kendo WinForms
          • Kendo Silverlight
      • Interactions
        • SendKeys
        • Validate
    • Selectors
      • Selectors in Code
      • Default Selector
      • Shared Selector
      • Selectors Category
        • CSS Selector
        • XPath Selector
        • Image Selector
        • Frame Selector
      • Identifying Selector
        • Identify for Windows Desktop
        • Identify for Web
  • How to Guides
    • Setting Up the Configuration
      • Parameters
      • Context
      • Loading External Data
    • Awaiting for the Application
      • Busy Loaders
      • Retries
    • Defining Controls
      • Extending Controls
      • Control Slice
      • Control Collection
    • Logging on Tests
      • QualityMate Reports
      • Logging
  • Help
    • Best Practices
      • Environment
      • Tests
      • Page Objects
      • Validations
      • Interactions
      • Image Comparisons
    • Known Issues
    • Continuous Integration
      • Agents Session
    • Upgrading QualityMate
      • From version 7 to version 8
      • Previous Versions
      • How to switch from TestFeature to UiTest
    • VS Test
      • Command Line
      • Generate Reports
  • API
    • Control Interfaces
      • IButton
      • ICheckBox
      • IComboBox
      • IControl
      • IControlSlice
      • IDateTimePicker
      • IElement
      • IGrid
      • IGroupBox
      • ILabel
      • IListBox
      • IMenu
      • INumericUpDown
      • IPageObject
      • IProgressBar
      • IRadioButton
      • IRadioButtonGroup
      • ISplitButton
      • IStatusStrip
      • ITab
      • ITextBox
      • IToggleButton
      • IToolBar
      • ITreeView
    • Behavior
      • ICheckableControl
      • IList
      • ITextControl
    • Enums
      • ClickType
      • KeyModifiers
      • MouseButton
  • Changelog
    • Changelog
      • Version 8
      • Version 7
      • Version 6
      • Version 5
      • Version 4
      • Version 3
Powered by GitBook
On this page
  • Plain File Comparator
  • XML File Comparator

Was this helpful?

  1. Tools

File Comparators

Plain File Comparator

Create an instance of the comparator by providing the file paths of the two files that are going to be compared, for example:

var comparator = PlainFileComparator.Create(myFilepath1, myFilepath2);

// Performing a custom assertion over the comparator instance.
comparator.Compare().Validate(result => result);

To be able to use the custom assertions over the comparators, you will need to import the Mobilize.QualityMate.Common.Extensions namespace.

Additionally the comparator can generate a verbose output that will help you to identify differences found within the files. Example:

comparator.ResultsInOutput = true; // This setting is "false" by default.
comparator.ResultType = PlainComparisonResult.PrettyHtml;
comparator.Compare();

If the files have differences, the comparator will generate a file with the prefix plaindiff and extension .html with the results.

The comparators' default output path is within the TestOutput folder.

XML File Comparator

This comparator works similar to the Plain File Comparator because both are based in the same class. Here is an example:

var comparator = new XmlFileComparator(expectedXmlPath, actualXmlPath)
{
    ResultsInOutput = true,
    XPathsInDescriptions = true,
};
comparator.CompareExcludingNodesByXPath("/Document/Parents").Validate(result => result);
comparator.CompareNodesByXPath("//Name", "//Priority", "//Goods").Validate(result => !result);

Multiple validations over the same comparator instance will print the results into the same output file.

PreviousGenerating QualityMate SolutionNextImage Processor

Last updated 3 years ago

Was this helpful?