End-to-End Testing in Iris Investigate
Iris Investigate Testing Methods
Hack Days were upon us and what was a quality assurance tester to work on? What would bring value to the company, make my job simpler, and be a fun thing to learn in the process? Was I too obvious? Based on the title of this blog, I’m sure you guessed my project focused on end-to-end test automation. Let’s delve into why I chose to work on test automation, what was used and how it works, and the benefits we’ve seen since implementation.
Automating things to make life simpler feels very natural to a lot of people, even in the most basic of applications; your car’s automatic transmission, recurring bill paying services, Roombas…all of these things were created to eliminate the monotony of the tasks they were designed to fulfill and allow you to focus on other, less trivial things in your day. Automating end-to-end tests in the tech world is helpful for the same reasons. I set my coffee machine before going to bed in order to free up more time in my day and to make sure I don’t forget anything important (forgetting my morning coffee is the worst!). When you begin to recognize that most of the manual tests you’re performing after every code push are the same, and that you’re spending hours making sure the same features remain in working order, it might be time to automate them and refocus the work you do into creating new tests.
There was much consideration given to multiple different testing tools. In the end I decided upon one of the newer challengers in the field: TestCafe. The driving reasons behind choosing TestCafe were that it uses modern JavaScript code and features, is very quick and easy to set up and maintain, has enhanced debugging for ensuring you’re targeting the correct elements within the DOM, and allows for quick switching between all of the different browsers that we support with our products.
Having chosen a tool, it now came down to translating every test I was manually checking off into JavaScript test cases that replicated how a user would navigate DomainTools Iris Investigate. Not being super fluent in JavaScript, I spent a bit of extra time nailing down the syntax, but that’s where the whole “learning” part of this adventure comes in. TestCafe works by attaching actions, such as typing text or clicking a button, to DOM elements on the page. For example, to perform an Iris Investigate query for domaintools.com, all you would need to do is find the HTML selector for the input box, tell it what to type, then instruct it to click on the search button.
Before we knew it, I could type a command in the terminal and a Chrome browser would pop up and start the process of logging in to Iris Investigate and performing tests right in front of me. If the test was successful, I’d be met with a beautiful green checkmark. If the test failed, I’d see an equally pleasing red X and accompanying screenshot of the failed step. This gives me a simple starting point for manually testing the failed feature as well as a foundation for writing a bug report on the issue.
Since writing this blog, we now have over 50 tests written in Iris Investigate alone, which takes a journey from creating an investigation to using each feature pane to manipulate the results, very much like a user would do. We’ve even set it up to run in headless browser mode every time a merge request is created using GitLab’s continuous integration features. This helps ensure that the fresh changes won’t break any existing functionality within Iris Investigate. If the new code is adding new features, it’ll give us time to create new tests at that moment. The tests so far have found several bugs early, allowing us to fix them before ever pushing them to production. There’s immense satisfaction in finding bugs early in the process and not letting them get in the way of using the product as it’s intended!
I think everyone has said at some point in their life that they wish they had more time in their day. This was a pretty simple solution to create more time in mine. In hindsight, automating myself out of my own job may not have been the wisest decision, but there are always blog posts to write, right?