Automated testing in ServiceNow: Robot Framework

4 December 2019| 2 min|

How Automated Testing Works at SPOC

Automated testing has been a hot topic for a decade now, and in every IT aspect.

For us automated testing has recently been a very important part of our SDL.

The need for automation has grown progressively, along with the need for high quality products delivered. When the QA team was formed, we had to come up with a solution to automate the repeatable processes, and we started to perform regression testing.

The first proposed solutions were based on JS and C Sharp, yet they were too complicated. It wasn’t possible to perform end 2 end testing because of the lack of full access to JS and C Sharp database. In ServiceNow we have access to API based on which we can perform automated testing.

But after a while, our research allowed us to find the new tools.

Automated Testing Framework

The first tool we thought to use was Automation Testing Framework (ATF). ATF is a built-in plugin in ServiceNow, used to perform regression test and unit test. It applies pre-build steps, including server side and client side steps.

As every tool, ATF has its own limitations. One of the limitations is end 2 end acceptance testing. Our approach toward this issue was solved via the additional testing framework called Robot Framework.

Robot Framework & ServiceNow

Robot Framework is a keyword-driven solution used to perform Acceptance Driven Test and Behavior Driven Test. We found out that Robot is very simple to write test cases and very intuitive. It’s built in Python, using Selenium Library and web driver. That’s a big advantage for our QA team, and everyone is able to write test cases and maintain them, fast.

Its syntax looks like this:

*** Test Cases ***
Valid Login
Open browser To Login Page
Input Username demo
Input Password mode
Submit credentials
Welcome Page Should Be Open
[Teardown] Close Browser

Additional advantage of Robot is that you can use Gherkin method to write readable test cases that are more business-oriented.

*** Test Cases ***
Valid Login
Given browser is opened to login page
When user “demo” logs in with password “mode”
Then welcome page should be open

We started with the creation of reusable keywords and our own repository. The generic keywords that we create can be used across the entire team and all the projects. Using Page Object Model, we are able to keep track of variables, locators, common keywords and test cases. Therefore to achieve 100% test cases coverage, we use both tools depending on the process.

At this moment the entire team is able to write automatic test cases and ensure highest quality.

Automated Testing as a Service

Our goal is to encourage more our customers to use automation and grow our expertise. Thus we’re going to offer Automated Testing as a Service soon. This will allow our customers to automate as many processes as possible, directly in their ServiceNow instances.

Automation is the future, but never will replace the manual testing, so at SPOC they go along together, saving time and the entire range of resources. This hybrid solution have proved to be a success for a while, and continues growing with fully motivated experts on our QA Team.