+ All Categories
Home > Documents > Application Testing Suite - Oracle · OpenScript Load Testing Automation Concepts Open Script...

Application Testing Suite - Oracle · OpenScript Load Testing Automation Concepts Open Script...

Date post: 31-May-2020
Category:
Upload: others
View: 24 times
Download: 0 times
Share this document with a friend
41
Application Testing Suite OpenScript Advanced Training: Troubleshooting your Load Testing Script Yutaka Takatsu Group Product Manager Oracle Enterprise Manager - ATS
Transcript

1

Application Testing Suite

OpenScript Advanced Training:

Troubleshooting your Load Testing Script

Yutaka Takatsu

Group Product Manager

Oracle Enterprise Manager - ATS

2

Agenda

Script Debugging Basics

OpenScript Load Testing Automation Concepts

What are the Correlations

What are the Solve Variables

What are the “Failed to solve” errors

Example: Script Debugging for Beginners

Oracle Learning Library: Oracle Application Testing Suite 12.1 Video Series:

http://apex.oracle.com/pls/apex/f?p=44785:24:0::::P24_CONTENT_ID,P24_PREV_PAGE:6587,1

3

OpenScript Load Testing Automation Concepts

User

Browser Client Application under test

User

Browser Client Application under test Load Testing

Functional Testing

Where do I fit below?

• OpenScript Load Testing automates transactions in the Protocol level.

Replaces the User. GUI level Automation

Replaces the Browser Protocol level Automation

4

• At the Playback, OpenScript Load Scripts replace the Browser (User Agent) and interact

directly with the Application’s webserver.

• Because they do not carry a browser, Load Scripts are lighter and more scalable than

Functional scripts

OpenScript Load Testing Automation Concepts

Open Script

Browser Client Application under test

Java Agent Client Application under test

Load Testing

Functional Testing

HTTP

HTTP API

Talks to the browser and let the browser do the rest

We are the browser and talk directly to the webserver I don’t carry a browser, so I am

a More Scalable script!

5

• How does the OpenScript LoadTesting Script interacts with the webserver?

• During the Recording, it uses Proxy Recorder to capture the HTTP communication

• During the Playback, Java Agent executes the command through the API and sends

HTTP requests directly to the server

Open Script

Application under test

Load Testing

Proxy Recorder Captures the HTTP req/res

Commands are written down to the script

Playback

Java Agent kicks the command

Directly interacts with the webserver

Internet/ Intranet

Recording

Browser

Proxy

OpenScript Load Testing Automation Concepts

6

OpenScript Load Testing Automation Concepts

Script

OpenScript

Application

RECORDING

• Let’s record a transaction in a load testing script

• Open a website and log into your application.

• Commands are written down to the script..

• But what do they really mean?

7

http.get(21, "https://sampleapplication.php",

http.querystring(

http.param("labelId", "3748"),

http.param("articleId", "207679")), null, true, "UTF8", "UTF8");

OpenScript Load Testing Automation Concepts

• The HTTP traffic is captured at the recording, and written down to

the script in the form of:

http.method commands. (e.g.http.get, http.post)

• At the Playback, OpenScript executes them ONE BY ONE until it

gets to the end of the Script.

http. Get request You will see

many of them

in the script

8

OpenScript Load Testing Automation Concepts

http.get(21, "https://sampleapplication.php",

http.querystring(

http.param("labelId", "3748"),

http.param("articleId", "207679")),

null, true, "UTF8", "UTF8");

http.post(29, "https://sampleapplication/auth_cred_submit"

http.postdata(

http.param("request_id"," 7440116077898809708 "),

HTTP Get Request

Query string Parameters show up in the URL at the

browser’s address bar. HTTP Post

Request

Postdata Parameters won’t be shown to the browser user

• Let’s take a closer look. OpenScript

proxy captured two navigations, HTTP

Get and Post. (*)

• HTTP Get request sends parameters

in a plain text, as a query string in

URL.

• Not secure and limited in size.

• HTTP Post request sends parameters

in a message body of the request.

• More secure method and not

restricted in size

9

OpenScript Load Testing Automation Concepts

• HTTP Get request sends parameters

in a plain text, as a query string in

URL.

• Not secure and limited in size.

• HTTP Post request sends parameters

in a message body of the request.

• More secure method and not

restricted in size

10

OpenScript Load Testing Automation Concepts

http.get(21, "https://sampleapplication.php",

http.querystring(

http.param("labelId", "3748"),

http.param("articleId", "207679")),

null, true, "UTF8", "UTF8");

http.post(29, "https://sampleapplication/auth_cred_submit"

http.postdata(

http.param("request_id"," 7440116077898809708 "),

• However the this script will fail at the at

the playback. WHY?

• In this application,

“request_id” a dynamic parameter, but

the value in the script is hardcoded with

the recorded data. This is a session ID

that application assigns to a user for

his/her duration for the visit (session).

• Script will fail because the recorded data,

which is no longer valid, will be used.

OK.. But.. Why do we need Session ID …?

Playback will use the recorded data that will

results in a failure.

11

• HTTP is a stateless protocol.

• HTTP does not provide any way of storing the user data between the requests.

What are the Session IDs?

Next page..

Web Server

Response

Request

Response

Request

First Page.. Hi Larry, here is the page..

Hi I am Larry. Give me the page

Hi it’s Larry again!. Give me the page

Ok, do I know you.. ?

but here’s the page anyway..

Server handles each request individually.

Larry

Larry Web Server

Site without Session ID

12

• However this makes creating a business website almost impossible

(e.g. track a state of the shopping cart in the book selling website).

• Session ID allows the application to maintain the information of the each of

the site visitors. Typically, used to identify the user logged in.

Next page..

Web Server

Response

Request

Response

Request

First Page.. Hi Larry, take this Session ID with the

page.

Hi I am Larry. Give me the

page

Hi Larry! Welcome

back. Here’s your page

Server keeps the state information from the user and relates the two requests

Session ID: abc123

Larry

Larry Web Server

Site with Session ID

What are the Session IDs?

Session ID: abc123

Hi it’s Larry again!. See my Session Id

13

• Session ID is a piece of data that is exchanged between

the application’s web server and the user agent (browser).

• Session ID is typically used to identify a specific user

logged on to the application for a particular duration of

his/her visit (=session).

• Every time a user logs on to an application, an application

gives the user a new Session ID.

• Session ID is given per Session. It is often destroyed

when the user logs off from the application. (next time you

visit the same site, you will have a different session ID)

Session ID:

abc123

Session ID:

xyz456

Today Tomorrow

Different Session IDs are assigned to the

each of the user visit

What are the Session IDs?

14

• How does a web page pass Session IDs to the webserver?

• Session ID is commonly stored in URL, Cookie, or in HTML page.

1.URL: Send back to the server as a string appended to URL following a

question mark (?)

e.g. (http://samplesite.com/ ?session_id=7AD30725122120803)

2.Cookie: A text information that application places in the client’s hard disk.

Browser sends the cookie back to the app to keep the state.

3.HTML : Stored in a hidden filed in a HTML Page and submitted by the http

Post Command.

e.g. <input type="hidden" name="sessionID" value="54321abcd">

OpenScript tries to handle the session ID

automatically. You can also configure manually

What are the Session IDs?

15

OpenScript Load Testing Automation Concepts

http.get(21, "https://sampleapplication.php",

http.querystring(

http.param("labelId", "3748"),

http.param("articleId", "207679")),

null, true, "UTF8", "UTF8");

http.post(29, "https://sampleapplication/auth_cred_submit"

http.postdata(

http.param("request_id"," 7440116077898809708 "),

Playback will use the recorded data that will results in a failure.

• We learned what is the session ID,

and OpenScript can handle the

application’s session ID. Let’s go back

to the example.

• This script will fail because the

recorded data, which is no longer valid,

will be used.

• As OpenScript replaces the user agent

(browser) at the playback, it cannot rely

on a browser to handle session IDs.

How can OpenScript make this script

work?

16

OpenScript Load Testing Automation Concepts

http.get(21, "https://sampleapplication.php",

http.querystring(

http.param("labelId", "3748"),

http.param("articleId", "207679")),

null, true, "UTF8", "UTF8");

http.solveXPath("web.input.requestid",

".//INPUT[@name='request_id']/@value",

“7440116077898809708 ", 0,

EncodeOptions.None);

http.post(29, "https://sampleapplication/auth_cred_submit"

http.postdata(

http.param("request_id","

"{{web.input.requestid}}"),

• At the playback, SolveXpath command

extracts the dynamic value from the HTML

page

• Post Data parameter value is substituted

during script playback

• The dynamic value will be used in the

Playback

This is the Correlation, and it is the main topic today

The variable is passed to the subsequent navigations

OpenScript extracts a value and stores in

a SolveXpath variable

The value stored in the variable is

used in the post data request

17

What are the Correlations?

• OpenScript uses (Solve) variables to pass dynamic data between

the navigations.

• During the Recording: OpenScript defines variables when

recording, and automatically correlates the dynamic data between

the navigations.

• After the Recording: You can use the Substitute variable option

from the Tree View to manually add custom variables to a script.

• Next time Recording: You can add your custom variables to the

library, and teach OpenScript to automatically correlate the dynamic

data from the next time.

18

What are the Correlations? – Code Example

• http.solveXpath method assigns the input values to script variables using Xpaths.

1. Finds the value “ta496”

from the source

2. Create a variable, store

the value in the variable.

INPUT_0 “ta496”

3. Apply the value to the

parameter.

“login” INPUT_0

19

What are the Correlations? – Code Example

• The variable looks for a value of an attribute “value”, from a Form INPUT object,

• where the value of an attribute “name” is “login”.

• So, the variable finds “ta200” from the source HTML.

• This value is used for the string substitution later in the script.

<INPUT id=login name=login value="ta200">

http.solveXPath(“INPUT_0",

".//INPUT[@name='login']/@value", "ta496", 0);

• Let’s check out the solveXPath Variable definition

Script Debugging Basics SQL users, you can think the logic is similar to :

“Select value.value from INPUT where name.value=login”

(command in

the script)

(HTML

source)

20

What are the Solve Variables? - Mainly Two types.

• Variables can be XPATH or Regular Expressions

Both variables look for the value “Login”, from the Tag:

(*) There are other methods does the string extraction, as in javascript, headers etc

21

What are the “Failed to Solve” Errors?

• It is typically the first problem users encounter when working on the load scripts.

• It can occur from mainly 2 reasons:

• Case A) The application returned the correct page, but the expected string was not found in the playback contents.

• Case B) The application returned a wrong page and therefore the expected string does not exist in the playback contents.

22

What are the “Failed to Solve” Errors? Case A

• Case A) The application returned the correct page, but the expected string was not found in the playback contents.

• Occurs when the server returned slightly different contents. The

possible causes are:

• Contents are dynamic (e.g. Purchase Order app that loads the different PO

information each time the script runs, or User defined contents are loaded by

different user log in)

• Regex /Xpath definition includes the dynamic text (*see next slide)

• Change has made in the page by the development.

You are in the right page.

The Variable failed is the Root Problem.

Investigate that variable!

(*) See notes section in this page for the more details when the regex/xpath includes the dynamic text

23

When dynamic text is included in the XPATH definition - Example

In this case, the string in the source dynamically changes as user iterates the script. A parameter includes a string MAt1 in its

first iteration, but MAt2 in the second iteration. Therefore the solveXpath variable could not find the string from the returned

content at the second iteration..

http.solveXPath( "web.input.pt1USma0MAt11pt1Purch10AP1",

".//INPUT[@name='pt1:USma:0:MAt1:1:pt1:Purch1:0:AP1:r1:0:q1:value40']/@value", "Mancia,Mathew",

The “name” attribute has changed in the second iteration.

First iteration: name=pt1:USma:0:MAt1:1:pt1:Purch1:0:AP1:r1:0:q1:value40

Second iteration: name=pt1:USma:0:MAt2:1:pt1:Purch1:0:AP1:r1:0:q1:value40

(simplified version)

http.solveXPath( "web.input.MAt1", ".//INPUT[@name='MAt1']/@value", "Mancia,Mathew",

The “name” attribute has changed in the second iteration.

First iteration: name=MAt1

Second iteration: name=MAt2

Playback fails at the second iteration, because Xpath

condition “@name=‘MAt1’” is no longer satisfied

24

What are the “Failed to Solve” Errors? Case A

<a href="http://www.amazon.com/Wiley-Review-

Business-Environment-

Concepts/dp/0470554304/" title="Wiley CPA

Exam Review 2011">

OpenScript assumed the

content is dynamic, and

created a variable on this link

25

What are the “Failed to Solve” Errors? Case A

Log on with a different user.

Contents are different. Because

the link does not exist, the

variable was not created

<a href="http://www.amazon.com/Wiley-Review-

Business-Environment-

Concepts/dp/0470554304/" title="Wiley CPA

Exam Review 2011">

26

You are in the WRONG page.

The Variable failed is NOT the Root Problem.

The root cause may be in the previous page request!

What are the “Failed to Solve” Errors? Case B

• Case B) The application returned a wrong page and therefore the expected string does not exist in the playback contents.

• Occurs when the server returned the incorrect page.

• Unable to run in the Browser

o Check if the application is down

• Runs fine in the Browser but script fails in OpenScript

o Dynamic String is not correlated

o String Substitution is not properly configured. (*see next slide)

27

When the string substitution is not properly configured - Example

In this case, the string substitution in the postdata parameter was improperly configured. OpenScript automatically substituted

the post data parameter J_id108, but the substitution was not happening at the playback. You took a look at the variable

definition in the Script’s treeview.

Original parameter:

J_id108=CV_SuppA00

After Correlated:

j_id{{web.option.PendingSupplierAcknowledgm,10}}8=CV_SuppA00

The correlation for the j_id108 parameter above has obvious problems. First of all, the value “j_id108” has split to the option

parameter 10 and with the hard coded value 8. This will never substitute the entire value. Second, it is extracting the value

from the wrong source. This is the fatal case when the variable was improperly created at the OpenScript recording.

Note:This particular issue was fixed in the current OpenScript and now it auto-correlates

the parameter properly.

Because of the wrong string substitution, postdata

parameter sends an invalid parameter that ends up in a

server error.

28

What are the “Failed to Solve” Errors? Case B

<a href="http://www.amazon.com/Wiley-

Review-Business-Environment-

Concepts/dp/0470554304/" title="Wiley

CPA Exam Review 2011">

OpenScript assumed the

content is dynamic, and

created a variable on this link

29

What are the “Failed to Solve” Errors? Case B

<a href="http://www.amazon.com/Wiley-

Review-Business-Environment-

Concepts/dp/0470554304/" title="Wiley CPA

Exam Review 2011">

Error page was loaded.

Because the link does not exist,

the variable was not created

30

Example: Script Debugging for Beginners

• You recorded an application

• Login, view profile, and logout

• However, the script failed at the

playback.

• The error message is:

HTTP response code: 500

Internal Server Error

31

Example: Isolate the problem

• Select the failed node in the

Result view

• Verify the playback contents in

the Details View/ Browser pane

32

Example: Analyze the findings

• Click the Comparison Tab in the

Details view.

• Compare the request headers

• You see the script used the same

session ID in the playback

This value could be

dynamic and it may be the

cause of the failure

33

Example: Analyze the findings

• Select the failed node in the

results tab, select “Find

Failure in Tree” to navigate to

the corresponding node in the

tree view

• The session ID is hard coded.

• This value needs to be

“correlated”

34

Example: Analyze the findings

• What was the

correlations? Let’s

review.

At the step2, The application assigns a dynamic

ID to the session, and embeds in the source.

At the step3, application uses the ID

in the Postdata parameter

However the value is hard coded in the script, and the recorded value

will be used at the playback. This will make the script fail.Let’s

correlate the value so that the script uses the dynamic value.

Step2

Step3

35

Example: Apply the custom correlations – Substitute strings

• In the tree view, select the

target Postdata parameter

• Right click, and Select

“Substitute Variable” from the

menu

• In the dialog, click “Create new

Variables”

36

Example: Apply the custom correlations – Substitute string

• Substitute Variable dialog allows you to :

extract the dynamic ID from the earlier

navigations (step2 in this case) , and

store in the variable so that you can pass it

to the later steps (step 3 in this case. )

• Define the Regular Expressions to

retrieve the value and press Next.

37

Example: Apply the custom correlations – Substitute strings

• Test the Regular Expressions to

make sure it retrieves the value

correctly & uniquely and press Next.

38

Example: Apply the custom correlations – Substitute strings

• Name the Variable.

e.g, “MyVar_ViewState”

• Optionally, click “Add to Library” to

add your custom rule to the library,

so that you can use your custom

variaible later in the scripts, or in the

other scripts.

• Click Finish to close the dialog

39

Example: Verify the custom correlations

• In the Tree View, step 2, expand the

navigation node.

• A script variable created for the string

extraction.

• In the Tree View, step 3, check the

postdata parameter

• The ViewState parameter is

parameterized; {{MyVar_ViewState,...}}

• At the playback, the string will be

extracted from the step 2, and passed

to the step 3.

40

Example: Verify the custom correlations

• Playback the script.

• The script passed the step 3.

• Check the comparison tab to verify the value is substituted

• Congratulations!

• The sample script still has other correlation problems in the next steps. Please see the video

training to resolve them. Sample script can be downloaded from the Oracle Learning Library.

Oracle Learning Library: Oracle Application Testing Suite 12.1 Video Series:

http://apex.oracle.com/pls/apex/f?p=44785:24:0::::P24_CONTENT_ID,P24_PREV_PAGE:6587,1

41

Thank You!


Recommended