X

Smart Advice. Personalized. Agile. Auditable

Much ado about testing OPA interviews

OPA interviews are designed to be:

  • Easy to develop, and
  • Easy to maintain

OPA includes built-in automated testing capabilities for ensuring your rules deliver expected results with every iteration.

Nevertheless, for extra guarantees of consistent behaviour between versions, some customers choose to build automated test cases for OPA interviews.

This can be particularly helpful if you have added JavaScript interview extensions or custom controls to your OPA interviews, and want to make sure the developers of those controls don’t introduce regressions in between releases.

Before you go down this path, the first question you should ask yourself is:

  • Does my team have the skills needed to do test automation?

OPA includes comprehensive tools for testing the rules that sit behind an interview, and these don’t require any particular testing expertise to use.

But web UI testing frameworks like Selenium require strong scripting and HTML knowledge. You should be sure you will have the ongoing skills in your team to design, develop and maintain that test suite.

Most large organizations already have strong quality assurance teams in place. They are the first people you should talk to before you go any further down the path of trying to automate interview testing yourself.

OK, so if you’re still reading, then either you don’t have an in-house team, or they’ve told you they are too busy and you need to work it out on your own.

Keep in mind that test automation is a skill that takes time to learn properly.  There are some good tutorials on the web for Selenium, which is a tool Oracle uses for testing our products between versions.

The basic steps to follow are:

  1. Define the OPA interview that you want to test
  2. Identify the test cases you want to automate
  3. Build your Selenium test cases
  4. Automate the process of deploying new OPA versions
  5. Automate the process of running the test cases against each OPA interview version

This is a pretty standard approach to continuous integration and delivery.

There are a few considerations to keep in mind when building Selenium test cases for OPA interviews:

  • It will be easier to build the tests if you have something that makes it easy for the test script to identify each control on the interview screen – for example, the question text associated to the control

Control on OPA interview screen:

Blank drop-down menu

Selenium test script snippet:

questionText = “What is the household’s location”;
webDriver.findElement(By.xpath("//label[contains(text(), \"" + 
		questionText + "\")]"));
  • Similarly, if your team has designed interview extensions, you can put in custom CSS classes to make it easy for the test scripts to find them, too

Interview extension JavaScript snippet:

OraclePolicyAutomation.AddExtension({
    style: {
        nextButton: {
            className: "custom-next-button"
        }
    }
}); 

CSS snippet:

nextButton: {
	className: "custom-next-button"
}

Selenium test script snippet:

webDriver.findElement(
		By.className("custom-next-button")).click();

In summary – OPA interview test automation can be a useful addition to ensuring high quality advice over time when using OPA, particularly when using custom developed JavaScript interview extensions. But make sure you have the skills you need to develop and maintain them before you get started down this path.

 

 

Title photo credit: Mari Lezhava via Unsplash

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services