First Steps With OATS: Recording a Test With OpenScript

A few weeks ago, I put together a small demonstration showing the possible impact of external sources (in this case an LDAP server) on the performance of secured ADF applications. The demonstration was a fairly simple one – showing the impact of a single request on network resources. A ‘real’ systems test will be more extensive than a simple demonstration, including:

  • Functionalty Testing: making sure that the application works as expected over time, often through automated testing.
  • Load Testing: Testing the performance of overall systems and integrated components.

Both types of testing typically involve different toolsets. For functionalty testing in web applications, there are tools like Selenium for automated functional testing. There are also shared approaches to functional and load testing, such as Apache JMeter. JMeter has been used successfully to test ADF applications – Chris Muir recently recorded a demonstration of setting up JMeter for ADF Testing. (As a side note, JMeter can also be used to test the performance of LDAP Servers…)

However, JMeter has often been difficult to use with session-based Java applications (not just ADF apps!) because of session parameters and cookie tracking. Fortunately, Oracle has a solution that is designed for functional and load testing of ADF applications (among others) packaged as part of the Oracle Application Testing Suite (OATS). OATS is a relatively large tool, so I’ll break up some of my own learning of OATS over a number of posts, beginning with the “language” of OATS – Oracle OpenScript.

First Steps With Open Script: Functional Testing

Open Script Splash Screen

OpenScript is less of a language than it is a combination of tools that can be used to create tests. First, we’ll need to install the OpenScript – which is part of either the full install, or the “micro” install for Windows. (Note: while the load testing environments and agents are avaialble for Linux platforms, the OpenScript development environment is Windows only, due to the Windows services used to record scripts.)

Once the OATS package has been installed, there will be an “Open Script” program installed in the Windows Start Menu. The Open Script editor is based on the Eclipse Java development environment – so you’ll be immediately familar with the layout of the editor if you have experience with Eclipse. What is different is the use of Windows services to record scripts. Let’s take a look at recording a simple script.

OpenScriptInStartMenu

Recording A Script

First, we need to identify the type of script that we are creating. When creating a script, we’ll be prompted to select the type of test that we want to create. We’ll create a functional test, but the dialog also gives us a view of the types of tests that we can create with OpenScript.

OpenScript Create Dialog

Once we choose “Functional Script”, we’ll be asked to add the script as part of a script library (you’ll be guided through creating a new library if one does not exist) and given a new test harness for the test we would like to create.

New Open Script Test

Before we record a script, we can note that in the editor we are shown two views of our script – the “Tree View”, or a “Java Code” view. If we take a quick look at the Java Code view we can see that our test is essentially a Java class with several dependency injections that interface with other services and modules in the Application Testing Suite.

Open Script Java

While our script will be a Java class that interfaces with these services, creating our script is not primarily Java coding, but rather using the OpenScript services to record actions taken in a web application. First, press the “record” button – this should start the OpenScript recorder; note the popup of the OpenScript toolbar and a menu bar in the browser itself (by default, Internet Explorer) indicating that a script is being recorded.

Open Script Recording

In the browser, follow a course of action that you would like to test. There are a full suite of tests available that allow you to test on any number of actions – such as mouse clicks, tab navigations, and even functions to allow you to test for certain sections of text and critera to ensure that your pages are also generating expected data.

When finished, the tool will have created a script with the steps that were followed in the recording. This script can now be played back in the OpenScript environment by using the ‘play’ button in the toolbar.

Open Script Complete Test

NOTE: If you are having trouble recording scripts, there is a handy option in the ‘Help’ menu called the OpenScript Diagnosis Tool that will run a check of your system to make sure that the required Windows services are running and that all browser plugins (required in the supported Internet Explorer and Firefox browsers) have been properly installed.

Open Script Diagnostic Tool

I also recorded a quick video (with no audio!) of recording and playing back a simple test script:

  • Izzati Jamal

    Hello. I tried creating HTTP test script using OATS but it recorded wrongly and I can’t seem to understand the nodes created. Can you please give a brief tutorial on how to use the feature? Thanks!

    • chad_thompson

      Izzati:

      Thanks for reading! I won’t be able to produce an example in the near term – a recent move meant I lost my virtual machines for setting up OATS. You might want to ask your question on StackOverflow (or even the Oracle Forums) – you might get a quicker answer there.

      Chad

      • http://www.facebook.com/rohit.palli Rohit Jayprakash Palli

        is it worth to use record and play using oats does it works efficently? mail me ur comment on rohitpalli@gmail.com

        • http://chadthompson.me cothomps

          “Is it worth it” is something of a subjective measure – the OpenScript recording feature was designed to allow “non-coders” (i.e. people who may only be trained in OATS) to create functional tests. The recorded tests can be used for load testing, etc. – so from the aspect of functional testing processes, OATS does have a few advantages over other testing tools. (Selenium, Cucumber)

          On the flip side – if you are a developer looking to quickly unit test, OATS may not quite be the tool for you; the functional testing tool requires a working application of sorts; OATS is not a Test Driven Development (or Behavior Driven Development) tool. In this case, OATS is best used to record (and continue to test) a working state of an application for integration testing or for verifying that modifications of functionality in one area have not changed functionality in another.

          As to ‘efficiently’ – I have not noticed any type of technical problem with OATS that would be “inefficient”; you’ll see most gains in efficiency coming in the realm of testing teams running regression tests. If you can script regression tests you can catch errors quickly before bringing in the testing teams, etc.

          (Does that answer your question?)

  • kaushik

    Hi,Can we record the scripts in Linux using Openscript

    • http://chadthompson.me cothomps

      As of this writing (or when I wrote this post), the answer is “no” – the OpenScript recording features are Windows only. I don’t know if that is entirely the case for the newest 12c release, but the following video from product management:

      Seems to indicate that only “IE 8 and Firefox 6″ are supported, which leads to believe that the Open Script recording functions remain Windows-only.

  • Nikitha

    How can we uplod/import this script into OATS? Please reply me soon