About Selenium
Selenium is a free set of tools for testing web applications in the browser. Information, downloads and a good online documentation is available at http://docs.seleniumhq.org/.
In short, it allows you to write scripts that will be executed within a browser. There is also a nice add-on for Firefox called Selenium IDE, which enables you to record and edit scripts directly in the browser. You can then also execute the scripts with the add-on.
Why This Blog Series?
I tried to use Selenium IDE for our WDA application and did everything in this blog with the Selenium IDE. Later on, I will also try the "real thing" with the Selenium server (called Web Driver) but first I want to do further tests with the IDE. I would also like to try the SeleniumABAP project by Gregor Wolf, see Automate Web Application Testing with Selenium for ABAP.
I started from zero and wanted to share my learnings here. Using Selenium for "normal" web applications is of course not new and you will find plenty of information about it with your favorite search engine. WDA, however, has some specialties that make browser scripting tricky:
- Almost everything is AJAX. The page is not reloaded when you click somewhere; instead, new page content is loaded from the server with JavaScript. That, of course, is also not unusal in normal web applications. The bigger problem is:
- The ID attributes in the HTML code are not stable. That is quite unusual and makes scripting tricky. I will go into more details in the next part. There are some
So this blog series is about the question: How do I write test scripts with Selenium for WDA?
Why Selenium At All?
Good question ;-) The typical choice for WDA test automation is of course ECATT. Period. There are three reasons why I started looking into Selenium at all:
- The systems you work with may not have eCATT enabled. That is (at least for now) the case for us. Since we are using agile development with short iterations and regular releases, however, we urgently need test automation. So we started looking for options.
- With a tool like Selenium, it seems easier to cover mixed scenarios, where not everything is Web Dynpro.
- Selenium can be used as a client-side tool - so it seems generally easier to start with.
As always, it does not solve every problem - I see it as an additional tool in the box.
Next?
In part 2, I will start describing how I wrote our scripts in detail. Part 3 adds some advanced things. (At least advanced for me...)
Test Scripts for WDA with Selenium - Part 2: Writing The First Two Scripts
Test Scripts for WDA with Selenium - Part 3: More Advance Stuff With XPath