Continuous Delivery – OPA and Selenium, NodeJS and Jenkins #5
Part five of this series moves away from the testing of Web Service-based projects to Interview-based. Interview projects present several different challenges for testers. Let’s take a look at some of them here, based on common tool requirements, and focusing on tools like Selenium IDE.
- The need to test quickly and often, usually repeating a set of operations to ensure that the Interview is functioning (so, opening a debug session and clicking through the different steps in an Interview, repeatedly, for example.
- Testing the Interview on a variety of different Web browsers, to doing the same as in step one, but on multiple platforms
- Automating all of the above, so that no time is wasted actually clicking though all that.
- Ability to ascertain whether things have gone according to plan – did the Interview display expected results?
Eagle-eyed readers will have noticed that Postman has disappeared from the title in this part of the series. That’s simply because we need different tools to do this job. There are a number of ways to face up to these challenges but not all of them come with the same cost or time requirement. Firstly, we should not overlook the use of the Debugger (either directly, or with Ctrl+F5 to run the Interview in a separate browser. But given that there are no automation capabilities built-in, if we want to run automated tests we will have to look elsewhere.
Option 1 : Use the tool with the simplest learning curve. Selenium IDE is the reborn, now browser-based tool that allows non-technical people to easily create simple tests and automate them. It has built in support for recording, branching tests and creating test suites made up of multiple tests. It has a very low entry requirement, since you don’t really need to know a great deal about programming to use it. The application is a rewritten version of the old Selenium IDE which is not supported any more and lacks the ability to work with modern browsers. Let’s look at how to use it, and then review the downsides.
The user interface is pretty simple. You can record, write scripts manually, run, pause and stop recording or executing. It is available for both Chrome and Firefox.
Notice the logging area at the bottom where you can see what is happening. One of the nice features is that while recording, it remembers several different ways to locate each item on the page (CSS, HTML ID, XPath, Relative XPath) so you should be able to learn a lot about how to “locate” things on pages of HTML. Plus of course if you need to you can edit them. The video below shows the basic principles, and shows how you can create loops and other control structures to get the job done. Your file can then be saved (as a .side file, because you will probably want to run it using the standalone tool called side runner.
As just mentioned it also has the Selenium side-runner command line interface to allow you to run your Suites without the IDE, and also use the Selenium Grid :
But there are some downsides:
- As mentioned above, it cannot currently load data from the file system, because as a browser Plugin it has security limitations.
- The format of the tests is not currently exportable to Selenium WebDriver JS (but it can create code for C# , Python and Java)
- Not all of the Selenium language is supported / the syntax is slightly different.
It’s a great first-step automation tool and worth watching – there is a plan to migrate away from browser Plug-in to a standalone application (much like Postman did) and that will remove many of the restrictions like file system access and data-driven project limitations.
As Fiona mentions in one of her blog articles, if you want to go further than this, you probably will need something more technical and industrial. And that’s what we will see in the next part in the guise of option two.
PS : If you are looking to learn about NodeJS, this book is on our current reading list. Note that this link is an affiliate link, purchases made from this link give a small amount to the intelligent-advisor.com Website which is used to pay for hosting the website.