16
Testing Oracle Forms with Openscript A Guide to using Oracle OpenScript to record a functional test with Oracle EBS/Forms With the release of Oracle Application Test Suite (OATS) 9.00, comes a new scripting tool called OpenScript. It is based upon the popular Eclipse IDE, and allows users/testers to record testing scripts (both load testing and functional testing) for a number of popular technologies, including: 1. Oracle EBS/Forms 2. Siebel 3. Web In this article we will concentrate on using OpenScript to record functional test with Oracle EBS/Forms. (NOTE: For testing Siebel applications or Java applications in general see the blog written by Alex Amat ). The Forms Environment. Before we can proceed with the testing the forms application, the first stage of this process involves making sure that the application can run from a normal web browser, and that the JInitiator environment is configured properly. First, you should install JInitiator. We used the 10g (10.1.2.0.2) Demos environment for this white paper.

Testing Oracle Forms With Openscript

Embed Size (px)

Citation preview

Page 1: Testing Oracle Forms With Openscript

Testing Oracle Forms with Openscript A Guide to using Oracle OpenScript to record a functional test with Oracle EBS/Forms

With the release of Oracle Application Test Suite (OATS) 9.00, comes a new scripting tool called OpenScript. It is based upon the popular Eclipse IDE, and allows users/testers to record testing scripts (both load testing and functional testing) for a number of popular technologies, including:

1. Oracle EBS/Forms2. Siebel3. Web

In this article we will concentrate on using OpenScript to record functional test with Oracle EBS/Forms.(NOTE: For testing Siebel applications or Java applications in general see the blog written by Alex Amat).

The Forms Environment.Before we can proceed with the testing the forms application, the first stage of this process involves making sure that the application can run from a normal web browser, and that the JInitiator environment is configured properly. First, you should install JInitiator.

We used the 10g (10.1.2.0.2) Demos environment for this white paper. 

FIgure 1: The opening screen for the Oracle Forms Demo NOTE : It is beyond the scope of this whitepaper to discuss the installation of the Oracle forms demo please visit

Page 2: Testing Oracle Forms With Openscript

http://www.oracle.com/technology/sample_code/products/forms/index.html and download the 10gR2 Demos package.

The operating system we will be using Microsoft Windows XP SP3 and, as OpenScript only supports Internet Explorer, a clean installation of Internet Explorer version 7.0.5730.13. A clean install of Internet Explorer is required because Oracle Forms does not work when certain plugins are installed on IE7 (See the Oracle forums for more information).

Stage 1- Install and configure JInitiator

(A) Installing JInitiator.When you first invoke your Oracle Forms Application, and JInitiator is not installed, the browser will automatically invoke the installation of JInitiator. You should see a screen like this:

Figure 2: The JInitiator Install Screen

Choose the installation directory, and let the install complete. Once this has been done close your browser, and restart, and then specify the URL again. In this install, to get to demos screen this will be: http://apollo.scloffice.com:8889/forms/formsdemo/demos.htmlChoose the appropriate URL for your installation.(B) Changing the default JVM dll.We found that, once the above steps have been completed, when you try to run the Forms demo, IE7 crashed. This issue has been documented on the Oracle

Page 3: Testing Oracle Forms With Openscript

forums. To fix, you should change the underlying jvm.dll - to do this you should download a suitable Sun JRE. We downloaded jdk1.5.0_16 JDK (which will contain the JRE client jvm.dll). Once this has been installed, you should copy over the jvm.dll to the relevant JInitiator directory. To do this:

Open a cmd shell, and change directory to the JInitiator installation directory. In our case this was g:\program files\oracle\jinitiator 1.3.1.22Change directory to the bin directory. cd binWithin this directory you will find a hotspot directory. Change to this directory i.e. cd hotspot.

Within this directory you should find two files Xusage.txt and jvm.dll.Copy the jvm.dll to a file called jvmoracle.dll copy jvm.dll jvmoracle.dllCopy the Sun jvm.dll to this directory copy g:\java\jdk1.5.0_16\jre\bin\client\jvm.dll . (Note the full stop to indicate the current directory)

copy jvm.dll jvm15016.dll (so that we can have both JVMs which can be swapped, just copy the relevant JVM to jvm.dll and JIinitiator will pick it up)Once this has been done restart the browser, and point it to the your application. You should now get a screen that looks like figure 3.

Figure 3: My Forms Application

Page 4: Testing Oracle Forms With Openscript

(C ) Configuring the JInitiatorOnce your application is running and you can successfully interact with it, we need to one final step before we talk about Oracle Forms and OpenScript. So go to Start -> Control Panel and click on the JInitiator 1.3.1.22 Icon. You should see a screen similar to figure 4. Make sure that the Show Java Console is enabled.

Figure 4: The JInitiator Control Panel

Once you have applied the Show Java Console setting, close the panel. Then restart IE7 and point it to your application. As well as your application showing up in your browser you should also see an extra window which looks similar to figure 5. We will be using this console window later on to make sure that OpenScript is recording interactions with the Oracle Forms Applet.

Page 5: Testing Oracle Forms With Openscript

Figure5: The Java Console for JInitiator

Once all the above has been completed we can then move on to installing OpenScript, and setting up the environment so that OpenScript and Oracle Forms can communicate with each other.

Stage 2 - Installing OpenScriptInstalling OpenScript is an easy process. Once you have the OpenScript installation program (available from http://www.oracle.com/technology/software/products/app-testing/index.html), unzip it to a suitable directory and you should be left with (at the time of this writing) a file called OpenScript900.exe. Execute this and you should see a screen similar to figure 5.

Page 6: Testing Oracle Forms With Openscript

Figure 6: The Openscript Install Screen

Follow the instructions, making a note of the installation directory. Make sure all browsers are closed at this point. Once the installation has completed and the Launch OpenScript now has been enabled, you should see a screen similar to figure 7.

Page 7: Testing Oracle Forms With Openscript

Figure 7: The OpenScript Welcome Screen

Once you have this screen you have successfully installed OpenScript. At this point close all browsers and close OpenScript. We still have a little more work to do.

Please read this before going to Stage 3You will NOT need to perform Stage 3 if you have installed patch number 9042747. This patch fixes the underlyting jar file problem. The patch is available from metalink.oracle.com. Once logged in, goto Patches & Updates->Simple Search and type 9042747 into the Patch Number/Name field. Once you have downloaded this patch, unzip to a temporary directory, and run openScript900.exe. Choose Install and let the installer finish. You should then be able to record your scripts. If you are unable to do this you will need to perform Stage 3. otherwise go to Stage 4.

Stage 3- Configuring OpenScript and Forms environmentOne of the first problems that users usually run into is that they try to record an Oracle EBS/Forms script, and notice that OpenScript does not recognise any of the applet objects. This is because of an underlying jar file problem. The solution is to create your own jar file that will be downloaded to the browser which will

Page 8: Testing Oracle Forms With Openscript

contain all the class files that OpenScript needs in order to communicate with Oracle Forms objects.

Within the Oracle Forms environment, you will find a file called frmall_jinit.jar (which is downloaded to the browser whenever you run a forms application). We will be creating our own version of this which will include all the support classes that OpenScript needs.

The first step we need to do is to unjar (or unzip) the frmall_jinit.jar to a temporary directory. So we need to create a new directory for our new jar file. So Create a temp directory

mkdir g:\temp\formsCopy over the frmall_jinit.jar to this directory copy g:\oracle\DevSuiteHome_1\forms\java\frmall_jinit.jar g:\temp\forms

Change to this directory and use jar tool to unzip cd g:\temp\forms and g:\java\jdk1.5.0_16\bin\jar.exe xvf frmall_jinit.jar (This will create a file called forms.jar)

Delete frmall_jinit.jar del frmall_jinit.jarWe now need to copy all the supporting jar files to this directory. The list of jar files are:

EBS11i_CrackedClass.jar fndaol.jar fndbalishare.jar fndctx.jar fndewt.jar fndforms.jar fndformsi18n.jar fndgantt.jar fndpromise.jar fndswing.jar fndtcf.jar fndutil.jar forms.jar jtfgrid.jar jtfscgnt.jar

(These will be located within either the forms environment and/or the OpenScript environment e.g.

g:\OracleATS90\OpenScript\OpenScript_configuration\org.eclipse.osgi\bundles\53\1\.cp\lib\formsClient\fndtcf.jar)

Next we need to unjar each of these files individually, as my version of jar does not support wildcards i.e. g:\java\jdk1.5.0_16\bin\jar.exe xvf *.jar will not work so G:\java\jdk1.5.0_16\bin\jar.exe xvf fndaol.jar

Repeat for each of the jar files.

You will notice that two directories have been created. These are oracle and javax. These directories will contain all the classes needed for OpenScript. So to

Page 9: Testing Oracle Forms With Openscript

create our new frmall_jinit.jar we will execute jar cvf frmall_jinit.jar .\oracle .\javaxOnce this file has been created we need to install this into the forms environment. In our environment the original frmutil_all.jar file was located in g:\oracle\DevSuiteHome_1\forms\java. So we will rename this file (so as to keep the original) cd g:\oracle\DevSuiteHome_1\forms\java andcopy frmall_jinit.jar frmall_jinit.jar.oldcopy g:\temp\forms\frmall_jinit.jar .We now have a frmall_jinit.jar which will support OpenScript. (Note : By default, All forms applications will try to download supporting jar files from the Forms environment. In my instance these will be in the g:\oracle\DevSuiteHome_1\forms\java\oracle\apps\fnd\jar directory. We already have all the classes we need so we changed the name of this directory to g:\oracle\DevSuiteHome_1\forms\java\oracle\apps\fnd\jarold. This will cause an exception to be thrown at initialization (which you will see in the JConsole window) and will then carry on to download the frmall_jinit.jar)

Stage 4- Recording and playing a test scriptRun the OpenScript executable (Start->All Programs->Oracle Application Testing Suite->OpenScript in my environment).Click Goto OpenScript Workbench.

Go to File->New and you should see a screen similar to figure 8.

Figure 8: The OpenScript Oracle EBS/Forms selection

Page 10: Testing Oracle Forms With Openscript

Click Next You will then see (minus our own testing scripts in the Existing scripts list):

Figure 9: The Openscript WorkBench

Give the script a name. In this example we have formsTest. Then click finish.You will then be presented with the following screen:

Figure 10: The JConsole window showing OpenScript Output

Click the red record icon and you should see a browser window popup as well as the following :

Page 11: Testing Oracle Forms With Openscript

Figure 9: The Openscript WorkBenchType in the URL of your application into the browser in our case http://apollo.scloffice.com:8889/forms/formsdemo/demos.html

Once your application is launched you should also see the JConsole window which contains important information as shown in figure 10. You will see some exceptions if you scroll through the information (e.g. FileNotFoundException etc), but most importantly you should see a bunch of cracked messages and OpenScript server port is 44444.

Page 12: Testing Oracle Forms With Openscript

Figure 12. The JConsole window showing the replay of the test script

You can then interact with the application, and you should see messages in the console window.

 Once you have finished recording, press the red stop button.

Page 13: Testing Oracle Forms With Openscript

When you return to the OpenScript workbench, click on Java View and you should see a screen similar to this:

 The important thing to notice is the forms.xxx api calls e.g. forms.textField(…).You can then play the script back and in the JConsole window you should see something similar to figure 12. (NOTE : If the script playback is slow go to OpenScript workbench View-> OpenScript Preferences and click on Playback. There will be a VU Pacing option. Change this to No Delay, and the script should run much faster).

Page 14: Testing Oracle Forms With Openscript

SummaryThis should be a one-time activity to enable successful recording of Oracle Forms testing scripts. You should now be able to record test scripts using OpenScript and Oracle EBS/Forms Applications