HomeOATS

OATS – How to capture value from oracle forms & use later

OATS – How to capture value from oracle forms & use later
Like Tweet Pin it Share Share Email

You should be aware of several things when working on test automation of Oracle EBS applications using OATS. One important thing among them is to capture value from oracle forms and use it later.

Let me explain it with an example here.

Assume that you are automating an order to cash end to end business flow scenario, the steps are enter the sales order, book the order, launch pick release and etc.

In this scenario as part of the process, User or test automation script performs the following steps.

  • Enter details in Sales Order entry form.
  • Click on Book Order button to book the order.

Now, once the order is booked a sales order number is generated automatically. This value is available in the “Order Number” text box of Sales Order entry form.

This is when in automation you need to know, how to capture value from oracle forms, that is from “Order Number” text box.

In this example we need to query the Sales Order number in “Release Sales Order” form and perform the next steps.

Lets see how to capture value from oracle forms now

You need a variable to store the captured value, following code captures the value from Order Number text field and stores in a variable.


// object identification of order number field.
String ordNumberTB = "[Name attribute value of Order number field]";

// code to capture value from oracle forms text box.
String ordNumber = forms.textField(ordNumberTB ).getText(); 

Now that we have captured value in to a variable, we need to look at how to utilize this variable in couple of ways. These ways are mostly dependent on automation framework’s design.

Case 1: Multiple scripts called from same parent script

Framework uses different scripts to Create Sales order and Release Sales Order and are called one after the other. Both these scripts are called in a sequence from a parent script.

Requirement: Should know how to pass values from one script to another.

Solution: Value captured in script 1 is stored a global scope. In the next script, code retrieves the value from global.

Following code explains it in detail.


// Script 1 code:

// object identification of order number field.
String ordNumberTB = "[Name attribute value of Order number field]";

// code to capture value from oracle forms text box.
String ordNumber = forms.textField(ordNumberTB ).getText(); 

// ordNumber is a variable containing the generated order
// in the book sales order script, store it in global variable
// following code helps you store globally.
getVariables().set("order_number",ordNumber);

// Script 2 code:
// as the value is stored in global 
// retrieve value from global using following code
// make sure that same variable name is used in different scripts
// in this example "order_number" should be in both the scripts.
String order = getVariables().get("order_number").toString();

// Later part of the script 2, use this value
forms.textField("[name attribute value of order]").setText(order);

Case 2: Single script for multiple functionalities

As per the framework, single script contains automation of both “Book Sales Order” and “Release Sales Order”

Solution: This is a simplest way, as there is no complexity of passing values from one script to another. You can directly use the variable which holds the sales order number in later steps of the script.

// Initial part of the script, capture and store value in a 
// variable. 
// object identification of order number field.
String ordNumberTB = "[Name attribute value of Order number field]";

// code to capture value from oracle forms text box.
String ordNumber = forms.textField(ordNumberTB ).getText(); 

// Later part of the same script, use the variable directly
forms.textField("[name attribute value of order]").setText(ordNumber);

Case 3: Multiple scripts and are called by different parent scripts or called separately

As per the framework, multiple scripts for “Book Sales Order” and “Release Sales Order”. When these are not called within the same parent script.

Requirement: In script 1, store the captured order number in to a physical or any persistent storage. Now in script 2, code reads data from this persistent storage and use it.

Solution: In script 1, you can possibly create a text or log file and write code to store the captured value in to this file. And, in script 2 you need to write code to read value from this file and use it. Reading and writing data from files may not be the scope of this article. I leave it to your imagination and exploration.

Comments (2)

  • Hi srinivas OATS is a open source. Other than OATS is there any open-source tools available to automate oracle e-business suite plz let me know

    Reply
    • Author

      Even i am looking for an open source tool which can automate Oracle EBS, if you get to know any time, please do share details here as well.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *