Welcome to the OPA Hub!

Category Archives: Testing

What’s New in Oracle Policy Automation 18A #2

What’s New in Oracle Policy Automation 18A #2

The second post in this series about What’s New in Oracle Policy Automation 18A covers the new administrative features relating to the REST API. As many readers will know, the latest versions of the product all provide a variety of interfaces that can be manipulated either using a traditional programming language (for example, in an earlier post we looked at using Microsoft Visual Studio and the REST API to review information about users, deployments and even to automate the download of a deployment ZIP file as a proof of concept), or other tools as explained below.

It is possible to use more modern tools such as curl command line tool and library to make calls and receive the JSON output. As a last resort or simply for test purposes one can always use SOAP UI. Although (naturally) we think of SOAP UI as a SOAP testing tool, it is equally at home testing REST endpoints.

What's New in Oracle Policy Automation 18A REST Project

The REST API requires the use of OAuth authentication, so you will need to set up an authentication profile and leverage it to acquire an access token. Once the token is acquired and as long as it has not expired, many calls can be made to the REST API endpoints for example for users, deployments but even (if licensed) the batch engine.

What's New in Oracle Policy Automation 18A OAuth

In the above example, the token is being accessed through Client Grant, using an integration user called integration_example. It assumes of course that this user exists on the Oracle Policy Automation Hub and has API access.

As we are discussing  What’s New in Oracle Policy Automation 18A #2, to quote from the official documentation :

Policy Automation Hub Administrators can now automate the lifecycle of end-to-end integration credentials. The OPA Hub REST API supports the management (create, view, update and delete operations) of three user types: regular users, local API client users and IDCS API client users.

As per the explanation above, the /users endpoint now supports not only normal, and API users but also an Identity Cloud Service user. In the example below, an authenticated call is made to the /users endpoint, and in the latest version this supports all the verbs you will need (GET,PUT, POST,PATCH,DELETE) to fully automate the users collection in your environment.

What's New in Oracle Policy Automation 18A Users Endpoint

Setting up Selenium for IE Testing with OPA

Setting up Selenium for IE Testing with OPA

I appreciate that a post about setting up Selenium has, in theory, not a great deal to do with Oracle Policy Modeling but if you come across a customer, who has Internet Explorer and wants to test their Interviews using their official browser, you will need to do it. The process is not very complicated but it took a bit of hunting around the internet so I reproduce it here

  1. Install Firefox

Of course, Selenium is mostly thought of as a Firefox Plugin IDE : a place for recording and editing scripts to test in Firefox and it is certainly the easiest way to get started.

  1. So go ahead and install the plugin from the Firefox Plugin Store. It is free. Install Selenium as a Firefox plugin so that you have an easy way to record and save your tests.
  2. Install Selenium stand-alone server and IE WebDriver.

You are going to need these to actually drive the tests through Internet Explorer.

  1. I installed selenium java version 2.53.1 since I could not get the newer release (3.x) to work the way I wanted it to, and I was not the only one it would appear.( http://selenium-release.storage.googleapis.com/index.html)
  2. Download the Internet Explorer Driver Server from the same page using the 32bit or 64bit version 2.53.1 depending on your Internet Explorer. Put them in a folder on your hard disk like c:\seltest or whatever you like.
  3. Ensure that JRE or JDK is installed so that you can actually run the java application
  4. In the Options Dialog of the Selenium plugin in Firefox, set the following to indicate you want to use the WebDriver for Internet Explorer.
    Selenium with OPA Setup
  5. Open your Oracle Policy Automation Interview in Firefox and record your script using the selenium plugin (File > New Test Case, then Action > Record). When you have finished recording the basic steps, Action > Record in the plugin dialog. You should have something like this : your script has been recorded.Selenium with OPA Script
  6. Start the IEDriverServer with a command line like
    java -jar -Dwebdriver.ie.driver=IEDriverServer.exe selenium-server-standalone-2.53.1.jar

    from the folder where you dropped the selenium server and IEDriverServer files (c:\seltest in my example)

  7. Actions > Play Current Test Case (or variations on that, as you build more test cases)

Your test will run in Internet Explorer and the output recorded in your selenium window for review.

Selenium with Final Script for OPA

Hint : When you have recorded your initial test case, find the first line (the one that opens the session) and replace the session-specific URL recorded with the base URL from the Deployment Page of your OPA Hub. Otherwise you will have an error with a session being expired (naturally) when you run through the script.

Hint : IE has some difficulties with selecting radio buttons, especially ones that have been replaced with images. You might find you have to rewrite some of the script with check, uncheck or something similar or even with the command RunScript to trigger a click on the image.

Hint : If you get an error about Protected Mode, ensure that all your Security Zones have the same Protected Mode setting (checked or unchecked, they just need the same setting)