What is Selenium and why we should be using it in Koha
We’ve all heard of unit test and perhaps some of us have even written a few. For those of you that have written unit test I’m sure you’re painfully aware that its pretty much impossible to get good test to see if the front end of your web app is functioning correctly. You could script something with Node.js or WWW::Mechanize to try some rudimentary test but it would still take a programmer to write them. Selenium aims to circumvent the programmer and allow the user to design their own test with a simple to use interface.
What Is Selenium?
Selenium is simple, it automates your browser. You can use selenium for simple use cases, such as: automation scripts, localized test cases, logging in to your email with 1 click. You can also use selenium for more complicated test cases that can be saved into testing suits and distributed across multiple environments and multiple users to allow for more comprehensive testing. For a bit more info checkout the selenium homepage.
Why Should I care?
How It Works
Selenium has a simple to use “IDE” that is a firefox plugin. Once installed you can start recording test and playing them back. Selenium works by recording the actions you do on the page. For example, you want to log into Koha. Selenium would record that you clicked on the username input and record what you typed. Then you would click on the password input and enter your password, selenium would record that as well. Finally you would click the submit button, which selenium would also record. All actions are recorded as an HTML format that selenium can read but can also be exported to many other languages. Selenium also integrates with Jenkins so when your builds take place you can make sure you’re shipping out good code.
I’ve created a short video to get you started with selenium testing that I’ll link below. Please feel free to hit me up in the comments for more videos or with any questions you may have.
I forgot to mention why we should be using this in Koha (As a developer). I believe this tool could be extremely useful in our QA/Sign-off process. If we submitted selenium test with our patches it would make testing said patches MUCH MUCH easier. This way I can see exactly what you are trying to test in either code form or in automated browser form. So if you want your patch to get through QA faster, consider writing a selenium test for it.
[Originally posted by Elliott Davis]
Read more by ByWater Staff