Unfortunately, too many folks will take a tool like Selenium and try to make it do everything for them without thinking about whether there is a better tool/library that could help them design more maintainable tests.
One of those libraries is Rest-Assured. If you haven’t heard of it, you can hear its creator Johan Haleby discuss it on the TestTalks episode Getting Started with REST-Assured.
We also had an awesome session from Bas Dijkstra on getting started with REST API testing with Rest-Assured in last years Automation Guild.
But once you know Rest-assured how do you get it to work with Selenium?
REST-Assured with Selenium
In his Automation Guild Session REST APIs and WebDriver: In Perfect Harmony, Mark Winteringham will demonstrate how he uses REST-Assured with Selenium to help him perform automated checks.
Mark explains that we need to design our automated tests/checks by thinking about the problems that we’re trying to solve, then use the right tools for those solutions.
But as he has seen too often, tools sometimes bias us as to how we solve a problem. This can be a big issue.
To avoid this problem, he demonstrates how we can identify some incorrect uses of WebDriver where HTTP and APIs could actually replace those areas without damaging the original value of that check.
The SACRED Model
Richard will also have a session at the 2018 Guild Conference, in which he’ll go into detail (using his famous whiteboard) to explain the SACRED model.
Mark will show how it helps you think about the different characteristics or attributes that a check has. SACRED is:
- State management – You can ask yourself “What sort of data is my test creating? Or “What sort of state is it trying to configure the browser or my product?”
- Algorithms – The steps an automated test will take to get to the point where it needs to carry out a check; moving through a series of different pages, for example.
- Codified Oracle – This is where assertions are being carried out. What are you asserting on? What are you comparing a value against?
- Reporting – Thinking about how to report passes and fails or what’s changed or what hasn’t changed.
- Execution – Are you running tests in parallel, or are you running them in a pipeline?
- Deterministic – Thinking about whether a check is subject to randomness, which might cause it to fail or become brittle.
Mark demonstrates how you can take these different ideas from the SACRED model and map them to your automated checks.
Questions to Ask As You Design Your Tests
The SACRED model will also help you clarify some important questions you should be asking as your design you tests, like:
- What is it that you’re trying to achieve?
- What’s the problem you’re trying to solve?
You should determine whether or not WebDriver is actually the right tool for you. Using HTTP or a REST API might be better in some instances, which Mark will demonstrate using Java with REST-Assured.
If you want to improve your automated checks, you don’t want to miss this awesome session.
Automation Guild 2018
Join Mark Winteringham and 20 other automation testing experts as they share tips, tools, techniques and best practices that will help you succeed with test automation in 2018! Register now –> https://automationguild.com