Day 5 of #30daysoftesting today and the task is:
Find, use and share your thoughts on a web UI testing tool
I am going to go the unoriginal route and pick the following stack:
Selenium Webdriver, jUnit & Cucumber. Only Cucumber is a new tool for me here, so that is my focus for this blogpost.
Why Cucumber? Because I played around with ityesterday at the workshop I attended.
My experience using Cucumber
So, my first task is to get all installation and configuration done. I noticed my laptop, which I have not used much the past few months, was actually poorly configured (read: abused by me). Many different Java JRE and JDK versions installed in different places, conflicting Java paths, different IDE workspaces, semi-removed programs and probably more that I cannot think of right now. Actually getting the issues resolved took some effort on my behalf (with the occasional help from fellow testers, thank you!).
On to the actual tool experience: Getting the tools installed and configured properly in an IDE and setting up a (Maven) project with all desired settings is an adventure on it’s own. Once that is all done, we can get started on organizing our work.
Create a feature file and write out a feature in it in Gherkin style, see this example (taken from the 10 minute tutorial on cucumber.io):
From that syntax you can click through to an actual script in which you write the code that Selenium Webdriver and jUnit need to perform said task.
Really, that was all! I am amazed how simple yet fantastic it is. I cannot imagine ever doing a web automation project again with Selenium Webdriver and not also include Cucumber! If you have not worked with it yet, please give it a try! Also check out the guide to add Cucumber in your continuous build with Jenkins and run the Cucumber-Reports-plugin for Jenkins to get a beautiful report with your cucumber test results, see below printscreens, taken from the Cucumber docs page.