In this article, I want to talk about a choice that I made when I was automating testing of XML files in the company I work.

Some facts:

For automation we use Ruby

We have more than two pretty big services that generate XML files. It means that we had a lot of tests

We wanted to use RSpec. This powerful testing framework showed itself so good in the previous projects

What was important:

Auto-tests should be easy to write

Auto-tests should be easy to read

What wasn’t important:

Ability to edit XML

Execution speed

Attributes checking

There are two ways to get data from XML files:

Using XPath or CSS selectors Using objects and methods that hide implementation

This article is about choosing that way.