by Troy Rudolph, Senior Software Engineer
The market certainly offers many test automation tools for testing in a variety of environments, but there is a relatively new one I particularly like for automated testing in web applications. While Codeception is intended primarily for testing PHP applications, the UI testing tools may also be used to easily create automated tests for web applications, as well.
In Codeception, these tests are referred to as acceptance tests. These tests are based on the notion of Behavior Driven Development (BDD). Essentially, BDD states that tests should be specified in terms of desired behavior. In the case of BDD, the behavior described is that of a user (or tester). To learn more about BDD, I would encourage reading the inventor’s article at http://dannorth.net/introducing-bdd.
A simple test might look like…
- I login
- I go the customer search page.
- I search for customer 314159.
- I go to the customer’s list of transactions
- I issue a refund for transaction 271828.
The Codeception API for acceptance tests takes this kind of thinking and runs with it. The API works at a lower level, of course, because in acceptance testing, we need to manipulate the screen elements to do our work. Here’s how the test above might look when implemented in Codeception.
The implementation of the test is indeed at a lower level than the user story, but it is not very different from it. This makes it possible for testers to implement stories more quickly and directly.
Additionally, Codeception can drive your application in a variety of ways.
Codeception is highly functional, reliable, and easy to use. The documentation at Codeception.com continues to improve and is more helpful today with recent changes. The code is open source and has the MIT license, thus it is all free.
So, if you are embarking on a test automation project for a web-based application, give Codeception a try and see if it doesn’t save you both time and effort.