Skip to main content

Custom VuC functions: icstatenum (for PeopleSoft 8.x)

Scott Barber, Performance testing consultant, AuthenTec

Currently, Scott Barber serves as the lead Systems Test Engineer for AuthenTec. AuthenTec is the leading semiconductor provider of fingerprint sensors for PCs, wireless devices, PDAs, embedded access control devices and automotive markets. He is also member of the Technical Advisory Board for Stanley-Reid Consulting, Inc.

With a background in consulting, training, network architecture, systems design, database design and administration, programming, and management, Scott has become a recognized thought leader in the field of performance testing and analysis. Before joining AuthenTec, he was a software testing consultant, a company commander in the United States Army and a government contractor in the transportation industry.

Scott is a co-founder of WOPR (the Workshop on Performance and Reliability), a semi-annual gathering of performance testing experts from around the world, a member of the Context-Driven School of Software Testing and a signatory of the Agile Manifesto. He is a discussion facilitator for the Performance and VU Testing forum on Rational DeveloperWorks and a moderator for the performance testing and Rational TestStudio related forums on QAForums.com. Scott speaks regularly at a variety of venues about relevant and timely testing topics. Scott’'||CHR(59)||'s Web site complements this series and contains much of the rest of his public work. You can address questions/comments to him on either forum or contact him directly via e-mail.

Summary:  The procedure and utility combination described here handles the PeopleSoft ICStateNum sequence number so that you can split, loop, and conditionally navigate scripts.

Date:  30 Jun 2005
Level:  Introductory
Activity:  234 views

Editor's note: This article is part of a library of custom VuC functions developed by performance test engineers to handle special situations encountered in scripting applications. For an overview of the library and links to other custom functions, see "A library of custom VuC functions."

The icstatenum procedure captures this PeopleSoft sequence number from a hidden field on the current page and places it into a string variable that's used for session identification and a security check on subsequent pages. The ICStateNum utility automatically inserts a call to the icstatenum procedure and replaces the references to the actual ICStateNum in the script with the new variable so you don't have to do it manually.

Purpose/Use

PeopleSoft 8.x has a unique method of tracking sessions and maintaining security. One component of that is the hidden variable ICStateNum. This variable is incremented in a variety of ways based on the type of transaction and tracked from page to page.

If you record straight-line scripts in PeopleSoft, or split scripts that will be played back in the order in which they were recorded, your scripts will work as recorded. But if you have a script that loops or contains conditional branching logic, it won't work as recorded, even if you correlate the ICStateNum variable. To make the script work, you need to modify the correlation variables. While it's possible to do this manually, using the icstatenum/ICStateNum combination is much faster and easier.

To use this procedure/utility combination, you'll need to have a script that was recorded against a PeopleSoft 8.x implementation to modify. First create the ICStateNum.s script as outlined below under "Utility Code." Then simply execute the ICStateNum.s script like you would any other VU script. When the script has finished executing, return to IBM® Rational Robot®. From the menu bar choose File > New > Script and enter the name of the modified script (this name must be identical to the name you substituted for "NEWNAME.S" in the ICStateNum.s script). Finally, copy and paste the actual procedure code into your script, or type in the appropriate #include command, and your new script is ready to be executed.

Note that this procedure/utility combination works only if one of these conditions is met:

  • You've got Rational v2002 LoadTest Patch 8 or later installed.
  • You've disabled gzip compression on the Web server.
  • You've removed or commented out the line "Accept-Encoding: gzip, deflate\r\n" in each http_request line.

Requirements

This procedure/utility combination works only in conjunction with an existing VU Robot script recorded against a PeopleSoft 8.x Web client, and with either Rational v2002 LoadTest Patch 8 or later installed or gzip compression disabled.


Procedure Code

Here's the code for the icstatenum procedure, to be included in the script:

string str_icstatenum;  

proc icstatenum(str_tmp_response)
string str_tmp_response;

{

   if ((match('html', str_tmp_response)) || 
      (match('HTML',str_tmp_response))){
      string tmp_string;
      tmp_string = substr(str_tmp_response,
         (strstr(str_tmp_response,"ICStateNum")),45);
      match('.*ICStateNum.*=.(\\\[0-9\\\]+)$0', tmp_string, &tmp_string);
      if (tmp_string != "") str_icstatenum = tmp_string;
   }
}

The icstatenum procedure can be placed in each calling script immediately following the #include command, or it can go in a separate .h file referenced by an additional #include command. The procedure can then be put in either the test script section of the repository or the Rational Test include directory. Putting it in the latter location will give you the benefit of not having to copy this procedure into every repository you work with.


Command Syntax

int icstatenum(_response)

The call to the icstatenum procedure takes the read-only variable _response as an input parameter and should be placed in the script following each http_nrecv to ensure that all instances of the ICStateNum variable are captured.


Utility Code

The ICStateNum utility simply replaces the actual ICStateNum value as recorded with the following code directly in the parameters section of the HTTP requests:

"+ str_icstatnum +"

Additionally, the utility places a call to the icstatenum procedure after every http_nrecv command in an existing script. This ensures that every HTML page is checked for the ICStateNum value.

Here's the code for the ICStateNum utility:

#include <VU.h> 
#include <sme\fileio.h> 

{ 
string str_oldscript, str_newscript, str_theline, tmp_string; 

result = 1;
str_oldscript = "GL_JE_base.S"; //Enter the name of the existing script here.
str_newscript = "GL_JE_test.S"; //Enter the name of the new script here.

oldscript=open(str_oldscript, "r"); 
newscript=open(str_newscript, "w");

while (result==1){
   result = ReadLine(oldscript);
   str_theline = NextField();
      if (strstr(str_theline, "http_nrecv") >0){
         fputs(" " +str_theline + "\n", newscript);
         fputs("icstatenum(_response);"+ "\n", newscript);
      }
      else if (match('.*ICStateNum=(\\\[0-9\\\]+)$0', str_theline, &tmp_string)){
         fputs(" " +substr(str_theline, 1, (strstr(str_theline, 
            "ICStateNum")) + 10) + '"+ str_icstatenum +"' + 
            substr(str_theline, (strstr(str_theline, "ICStateNum")) + (11 + 
            strlen(tmp_string)), (strlen(str_theline))) + "\n", newscript);     
      }
      else if (match('.*"ICStateNum=".*', str_theline)){
         fputs(" " + '"ICStateNum="+ str_icstatenum +' + "\n", newscript);
      }
      else{
         fputs(" " +str_theline + "\n", newscript);
      } 

   }

close(oldscript);
close(newscript);
}

In the code, replace "YOURSCRIPTNAME.S" with the name of your existing script and replace "NEWNAME.S" with the name of the new script you're about to create. Then copy and paste this code into a new VU script and save it, as follows:

  1. Choose File > New > Script from the Robot menu bar.
  2. Name the script ICStateNum, ensure the VU radio button is selected, and click OK.
  1. Delete any auto-generated code in the script window.
  2. Paste the ICStateNum code into the script window.
  3. Click the green checkmark on the main Robot menu bar to compile the script.

Examples of Use

The PeopleSoft program is designed so that users can log in, then perform many different activities in random order. To model such activity, split scripts would typically be created where each split script models a single activity, and scenarios would be created with selectors to randomize the activity of a particular user to represent the expected usage model over a certain number of users. For example, a typical suite might look like this:

Because of the way the automatic sequencing of the variable names works, this suite wouldn't execute properly without the use of the icstatenum procedure unless there had been significant manual changes to the out-of-the-box correlation available with TestStudio. In the scenarios above, the only path that would work correctly would map out to Login, Activity1, Activity2, Signout. All others would fail.


About the author

Currently, Scott Barber serves as the lead Systems Test Engineer for AuthenTec. AuthenTec is the leading semiconductor provider of fingerprint sensors for PCs, wireless devices, PDAs, embedded access control devices and automotive markets. He is also member of the Technical Advisory Board for Stanley-Reid Consulting, Inc.

With a background in consulting, training, network architecture, systems design, database design and administration, programming, and management, Scott has become a recognized thought leader in the field of performance testing and analysis. Before joining AuthenTec, he was a software testing consultant, a company commander in the United States Army and a government contractor in the transportation industry.

Scott is a co-founder of WOPR (the Workshop on Performance and Reliability), a semi-annual gathering of performance testing experts from around the world, a member of the Context-Driven School of Software Testing and a signatory of the Agile Manifesto. He is a discussion facilitator for the Performance and VU Testing forum on Rational DeveloperWorks and a moderator for the performance testing and Rational TestStudio related forums on QAForums.com. Scott speaks regularly at a variety of venues about relevant and timely testing topics. Scott’'||CHR(59)||'s Web site complements this series and contains much of the rest of his public work. You can address questions/comments to him on either forum or contact him directly via e-mail.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=4278
ArticleTitle=Custom VuC functions: icstatenum (for PeopleSoft 8.x)
publish-date=06302005
author1-email=dwinfo@us.ibm.com
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers