OPA interviews are designed to be:
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:
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:
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:
Control on OPA interview screen:
Selenium test script snippet:
questionText = “What is the household’s location”; webDriver.findElement(By.xpath("//label[contains(text(), \"" + questionText + "\")]"));
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