Turn your manual testers into automation experts! Request a DemoStart testRigor Free

ServiceNow Testing

“Approximately 85% of Fortune 500 companies use ServiceNow.” (source)

About ServiceNow

A well-known name in the IT service industry, ServiceNow is a cloud-based platform specializing in automating and managing digital workflows for enterprise operations. Founded in 2004, ServiceNow has grown to become a leading provider of IT service management (ITSM) solutions. Still, its offerings have expanded far beyond just ITSM to encompass various areas of enterprise operations. It is designed to help organizations improve operational efficiencies by streamlining and automating routine work tasks.

The ServiceNow Store

Along with its out-of-the-box products, ServiceNow also includes an app store. This is a repository of pre-built applications and integrations developed by both ServiceNow and independent software vendors. These solutions address specific industry needs, extend core functionalities, and solve unique business challenges.

If you’re planning to add your app to this ServiceNow Store, you need to do the following:

  • Register as a ServiceNow Partner. You can also apply as an individual developer, though you might miss out on official store listing and monetization features.
  • Develop your app using ServiceNow’s tools and platforms. Test your app thoroughly before publishing it.
  • Consider user feedback and incorporate it and community insights during development.
  • Publish your app. If you’re a partner, upload your app through the Partner Portal. For individual developers, share your app in the ServiceNow Community.

Development in ServiceNow

The out-of-the-box products that ServiceNow offers may not fit into your existing system. Hence, you might need to customize it in one of the following ways.

  • Custom app development: For highly specific needs requiring extensive customization and unique functionalities.
  • Customizations: For optimizing existing functionalities or integrating with other systems within your organization.
  • App Store app development: For creating broadly usable solutions with potential revenue generation across a wider audience.

Configuring v/s customizing ServiceNow

The easier approach would be to configure ServiceNow using the built-in options and settings to adapt ServiceNow to your specific needs without changing the underlying code.

Here are some examples of configuration.

  • Creating new roles and users: Define access levels and permissions for different users.
  • Modifying existing forms and fields: Add, remove, or change forms’ fields to capture the needed data.
  • Creating new workflows and business rules: Automate tasks and processes based on your specific requirements.
  • Customizing dashboards and reports: Tailor the information displayed to suit your needs.

If you cannot achieve what you want through configuration, then you can customize ServiceNow. For this, however, you will need coding experience.

Here are some examples of customization.

  • Creating new widgets and UI elements: Design custom interfaces for specific tasks or data visualization.
  • Developing custom integrations: Connect ServiceNow with other systems and applications.
  • Modifying core functionalities: Change the way ServiceNow works at a deeper level.

Technologies needed to customize ServiceNow

The primary programming language used for customizing ServiceNow is JavaScript. This is true for various aspects of customization, like

  • Client scripts: These scripts run on the client side (user’s browser) and are used to manipulate the user interface, validate data, and perform other actions.
  • Server-side scripts: These scripts run on the ServiceNow server and can interact with the database, send emails, and perform other backend tasks.
  • Business rules: These are used to automate processes and decisions based on certain conditions. They are also written in JavaScript.
  • UI Macros: These are reusable components that can be used to build custom user interfaces. They primarily use JavaScript with HTML and CSS for styling.

While JavaScript is the core language, some additional technologies are involved in ServiceNow customization.

  • Glide system: This JavaScript API provides access to ServiceNow data and functionality.
  • UI Framework: The user interface of ServiceNow is built using AngularJS, so understanding this framework can be beneficial for complex UI customizations.
  • REST APIs: These APIs can be used to integrate ServiceNow with other systems and applications. Other languages like Python or Java might be used depending on the integration. However, you may not find enough documentation for working with a programming language other than JavaScript for ServiceNow.

ServiceNow tools and platforms for customization

ServiceNow offers robust tools and platforms to support customization across various levels, catering to no-code and code-based needs. Here’s a breakdown.

No-code and low-code tools

  • Studio: A drag-and-drop interface for building customized applications, workflows, and user interfaces without writing code. It includes features like
  • Form Editor: Designs and modifies forms to capture specific data.
  • Workflow Editor: Automates tasks and processes visually.
  • UI Builder: Creates custom dashboards and reports.
  • App engine: Builds enterprise-grade applications with pre-built components and low-code capabilities.
  • Flow designer: Automates basic tasks and processes without coding.
  • Configuration Management Database (CMDB): Extend and customize the CMDB using built-in features and integrations.

Coding-based tools

  • Script editor: Uses JavaScript code for server-side scripts, client scripts, UI Macros, and business rules.
  • IntegrationHub: Integrates ServiceNow with other systems and applications using pre-built connectors or custom code.
  • Plugin Development Kits (PDKs): Develop custom plugins to extend ServiceNow functionality with advanced features.
  • ServiceNow Mobile Development Kit (MDK): Build custom mobile applications for ServiceNow.

Platforms

  • Now Platform: The underlying platform offering core functionalities and APIs for development.
  • ServiceNow Developer Portal: Provides resources, documentation, and tools for developers.
  • ServiceNow Community: Connect with other developers and experts for help and learning.

Testing ServiceNow

Whether you are customizing ServiceNow products, building integrations, or creating apps for the ServiceNow app store, you must test your code. You can use the following approach to do this.

Unit Testing

Unit testing constitutes the first level of application testing in the test automation pyramid. This stage involves examining individual units or components of the application in isolation from the rest of the system to verify that each unit operates as expected. By catching defects early in the development cycle, unit testing can save time and resources by preventing more severe bugs further down the line.

ServiceNow provides a wholesome testing framework for unit and integration testing. The tools that work best in these cases are as follows.

Jasmine

Jasmine is an open-source testing framework utilized within ServiceNow for unit testing. It is written in JavaScript and offers a straightforward syntax for outlining tests and assertions. It is frequently used in conjunction with other JavaScript testing tools and frameworks and can be employed for both front-end and back-end testing.

The unit test cases are housed in the “Client Test Scripts” section of the Test Management module in ServiceNow. You can access this section by navigating to “Test Management” -> “Test Suites” -> “Client Test Scripts”. From there, you can create a new test script, which lets you write your test cases using the Jasmine framework.

Below is a sample code utilizing Jasmine.
describe('My ServiceNow Application', function() {

  var myApp = new MyApp();

  describe('Functionality Tests', function() {
    it('should define the application', function() {
      expect(myApp).toBeDefined();
    });

    it('should have a function to create a new record', function() {
      expect(myApp.createNewRecord).toBeDefined();
    });

    it('should have a function to update an existing record', function() {
      expect(myApp.updateRecord).toBeDefined();
    });
  });
});

Integration Testing

This form of testing is typically done after unit testing and before end-to-end testing to ensure that individual components operate correctly when integrated as a system. This integration is crucial in ServiceNow as you want to ensure your system’s existing modules work smoothly with your chosen ServiceNow modules.

You will find ServiceNow recommending testing tools like ATF and IntegrationHub for integration testing.

ServiceNow’s Automated Test Framework(ATF)

The Automated Test Framework (ATF) is ServiceNow’s testing framework. Built directly into the platform, it is well-equipped for testing all ServiceNow application aspects and supports various testing types. With ATF, users can create and execute automated tests that simulate interactions between ServiceNow and other systems via web services or APIs.

Consider the following integration test script designed to log an incident in a ServiceNow application.
var testSuite = 'My Integration Tests';
var testCaseName = 'My Test Case';
var testCase = new sn_atf.Testcase();

testCase.initialize(testCaseName, testSuite);

testCase.addStep(new sn_atf.Step('Log in to ServiceNow', function() {
  sn_atf.utils.login('admin', 'password');
}));

testCase.addStep(new sn_atf.Step('Create a new incident', function() {
  var gr = new GlideRecord('incident');

  gr.initialize();
  gr.short_description = 'Test Incident';
  gr.description = 'This is a test incident created by ATF';
  gr.insert();
  assert.ok(gr.getUniqueValue(), 'Incident record created successfully');
}));

testCase.run();

End-to-End Testing

You might want to do end-to-end testing with ServiceNow in the picture for many reasons. Maybe the ServiceNow modules you integrated with have been updated, or you want to check if the integration is working correctly in the first place, or if you’ve created a custom app, you might want to ensure its behavior.

Through end-to-end testing, you can test an entire application from start to finish, including all components and integrations, to ensure that the application works as intended. Test scenarios created are run in real-world-like simulations, which may involve interactions with external services or databases.

Since end-to-end testing is done through the UI or web browser, you needn’t worry too much about underlying code or the application’s code restricting you. This is provided; you opt for tools that are agnostic to such details.

Here are some test automation tool options for end-to-end testing.

Selenium

Selenium is a popular web automation tool for end-to-end application testing. It requires you to code test cases in any programming language like Java, Python, Ruby, etc.

Here’s a sample test case created in Selenium.
WebDriver driver = new ChromeDriver();
driver.get("https://<yourinstance>.service-now.com");
WebElement username = driver.findElement(By.id("user_name"));
WebElement password = driver.findElement(By.id("user_password"));
username.sendKeys("your_username");
password.sendKeys("your_password");
driver.findElement(By.id("sysverb_login")).click();
driver.get("https://<yourinstance>.service-now.com/nav_to.do?uri=%2Fincident.do%3Fsys_id%3D-1");
WebElement shortDescription = driver.findElement(By.id("incident.short_description"));
WebElement description = driver.findElement(By.id("incident.description"));
shortDescription.sendKeys("Test Incident");
description.sendKeys("This is a test incident created via Selenium");
driver.findElement(By.id("sysverb_insert")).click();
WebElement incidentNumber = driver.findElement(By.className("outputmsg_text"));
assert incidentNumber.getText().contains("INC");
driver.quit();

Selenium depends heavily on the XPath or the IDs of the elements. So, any change in the DOM element property causes the test case to fail. Also, the code complexity increases when more scenarios are created in Selenium, making code debugging difficult. So, with all these disadvantages, most organizations prefer other testing tools.

testRigor

If you want to focus on creating quality test cases rather than worrying about coding them, then testRigor is your pick. You can even find the testRigor app in the ServiceNow Store as an official app for automation testing.

This revolutionary AI agent understands plain English statements and conducts tests from an end-user’s perspective. This innovative approach to automation allows your organization to achieve multiple key objectives simultaneously.

  • Plain English tests: Enable your existing employees to build test automation, regardless of their technical proficiency. As testRigor is a generative AI-driven, no-code solution, setting up the environment and building tests becomes more seamless and efficient than traditional testing tools.
  • Ultra-stable test scripts: Ensure your automation system is robust enough to withstand the release of new versions. This is very important for ServiceNow as they constantly update and release newer versions. Unlike other systems, testRigor does not rely on the detailed specifics of the implementation. This results in unparalleled stability, saving countless hours each week.
  • Team collaboration: Enhance visibility within the team, as anyone can understand the tests and contribute if needed.
  • Cross-platform testing: Create a collaborative platform for cross-platform testing, including mobile app testing, which can come in handy to test ServiceNow mobile integrations.
  • Minimum maintenance: Negligible test maintenance is possible with this tool, thanks to its use of AI.
  • Powerful integrations: This tool supports integration with different tools and frameworks, making it easy for you to expand your testing ecosystem.
Here’s a sample of a testRigor script where we create a new incident in a ServiceNow application.
open URL "https://<yourinstance>.service-now.com"
login
check that page contains expression "Hello, UserName"
click "Create Incident"
enter "New Short Description" into "Incident description"
click "Add Incident"
check that page contains "New incident created successfully!"

Creating a free account with testRigor is effortless as it is a cloud-based platform. You can also avail of the enterprise versions based on your needs, as these versions tend to include some features that aren’t available in the free version.

Conclusion

The core of ServiceNow’s appeal lies in its highly flexible platform, which supports extensive customization and scalability to meet the needs of large and complex organizations. Its ability to automate workflows across various departments, not just IT, helps break down silos within organizations, facilitating a more integrated and efficient approach to service management.

A robust platform like ServiceNow needs a vital QA process to ensure the best services to your customers. You can guarantee that if you balance out manual and automated testing as and when required by employing powerful tools for the same.

Related Articles

Infor Testing

Infor ERP is a comprehensive software solution designed to help organizations efficiently manage and streamline their business ...

Oracle Testing

You may know Oracle from its database services. However, Oracle’s product portfolio is vast and caters to a wide range of ...

Vista by Viewpoint Testing

Experience an all-inclusive construction accounting and operations solution that offers unmatched customizability, scalability, ...