Loading ...
Sorry, an error occurred while loading the content.

Re: [LoadRunner] Re: How to write reusable function in LR..

Expand Messages
  • Suresh Nageswaran
    Correction: ANSI C not C++. LR uses the GNU LCC compiler - which is ANSI C. -Suresh ... __________________________________ Do you Yahoo!? Yahoo! Mail - now
    Message 1 of 10 , Feb 1, 2005
    • 0 Attachment
      Correction: ANSI C not C++. LR uses the GNU LCC
      compiler - which is ANSI C.

      -Suresh

      --- Chaminda <cdivitotawela@...> wrote:
      > You must think LR is as C++.



      __________________________________
      Do you Yahoo!?
      Yahoo! Mail - now with 250MB free storage. Learn more.
      http://info.mail.yahoo.com/mail_250
    • sunil sharma
      hey.. Thanks guys...i guess writing reusable header file should work...can i use this header only in 1 action out of like 5 actions?..i mean not using as a
      Message 2 of 10 , Feb 1, 2005
      • 0 Attachment
        hey..

        Thanks guys...i guess writing reusable header file
        should work...can i use this header only in 1 action
        out of like 5 actions?..i mean not using as a global
        in init..?
        thanks.
        sunil.

        --- Chaminda <cdivitotawela@...> wrote:

        >
        >
        > Hi,
        >
        > You must think LR is as C++. Reusability can be
        > implemented with
        > header files. I will show how it can be done in
        > simply way.
        >
        > Header File TestHeader.h placed in the include
        > directory on Load
        > Runner folder.
        >
        > --- Start of Header file
        > ----------------------------
        > void TestFunction()
        > {
        > web_url
        >
        ("www.google.com","URL=http://www.google.com/","Resource=0","RecConten
        >
        tType=text/html","Referer=","Snapshot=t1.inf","Mode=HTML",LAST);
        > }
        >
        > --- End of Header File
        > ------------------------------
        >
        >
        >
        > --- Inside LR Script
        > --------------------------------
        > #include "web_api.h"
        > #include "TestHeader.h"
        >
        > Action()
        > {
        >
        > TestFunction(); //Implementation in TestHeader.h
        >
        > web_submit_form("search",
        > "Snapshot=t2.inf",
        > ITEMDATA,
        > "Name=q", "Value=Load Testing", ENDITEM,
        > "Name=btnG", "Value=Google Search", ENDITEM,
        > LAST);
        >
        > return 0;
        > }
        >
        > --- End LR Script --------------------------------
        >
        > Hope this will answer your need.
        >
        > Thanks.
        > Chaminda
        >
        >
        > --- In LoadRunner@yahoogroups.com, sunil sharma
        > <sun_jobs2003@y...>
        > wrote:
        > >
        > >
        > > Hello everyone,
        > >
        > > I am working on HTTP protocol and have few actions
        > in
        > > my script. Some of the actions are same for other
        > > scripts also, so i want to just call that part of
        > > script in 1 line except writing the same long
        > code.
        > >
        > > does anyone know how can i do it?..is there
        > something
        > > like local/global function we can define in
        > > loadrunner, so that i dont need to write same
        > script
        > > code everywhere...example: if i can define "login"
        > as
        > > a global function, i just need to call in 1 line
        > > where-ever i need it..?
        > >
        > > I hope i haven't confused anyone..Looking forward
        > for
        > > some answers..
        > > thanks..
        > >
        > > Sunil.
        > >
        > >
        > >
        > >
        > >
        > > __________________________________
        > > Do you Yahoo!?
        > > The all-new My Yahoo! - Get yours free!
        > > http://my.yahoo.com
        >
        >
        >
        >
        >
        >
        >




        __________________________________
        Do you Yahoo!?
        Meet the all-new My Yahoo! - Try it today!
        http://my.yahoo.com
      • Sumita Haldar
        hello Jeremie, Thanks for the reply hope it works. sumita On Mon, 31 Jan 2005 08:16:31 -0500, jeremie.w.dowdrick@convergys.com
        Message 3 of 10 , Feb 4, 2005
        • 0 Attachment
          hello Jeremie,

          Thanks for the
          reply hope it works.


          sumita

          On Mon, 31 Jan 2005 08:16:31 -0500, jeremie.w.dowdrick@...
          <jeremie.w.dowdrick@...> wrote:
          >
          >
          >
          >
          > Sumita not sure if you seen this on the merucry web site But I thought I
          > post it.
          >
          > 5/31/04
          > Preparation before record – Internet Explorer Settings
          > To avoid problems, verify and change the following Internet Explorer's
          > settings before you try to record:
          > 1. Enable all ActiveX controls and plug-ins. This option is available in
          > Internet Explorer Tools Internet Options Security Custom Level).
          > 2. Enable the "Use HTTP 1.1 through proxy connection" option. This
          > option is available in Internet Explorer Tools Internet Options
          > Advanced, under the "HTTP 1.1 settings" radio button.
          >
          > Recording Siebel script with Auto-Correlation option
          > Correlation is the mechanism by which VuGen saves dynamic values to
          > parameters during record and replay, for use at a later point in the
          > script. For general information about correlation, you can refer to Problem
          > ID 11806 - What is correlation and how is it done
          >
          > For Siebel script, you can instruct VuGen to automatically apply
          > correlation during recording using one of the following methods:
          > · VuGen Native Siebel Correlation
          > The native, built-in rules, work on a low level, allowing you to debug
          > your script and understand the correlations in depth.
          > · Siebel Correlation Library
          > The Siebel correlation library automatically correlates most of the
          > dynamic values, creating a concise script that you can replay easily.
          > Note that this is only available for Siebel 7.7 and the library is
          > distributed by Siebel.
          >
          >
          > How to record with VuGen Native Siebel Correlation
          >
          > VuGen's native built-in rules for the Siebel server detect the Siebel
          > server variables and strings, automatically saving them for use at a later
          > point within the script. It is available in VuGen recording option by
          > default; you do not need to have any additional components installed.
          >
          > Steps to record with Native Siebel correlation:
          >
          > 1. From the 'New Multiple Protocol Script' window, add 'Siebel-Web' and
          > click OK.
          >
          > 2. Set the following Recording Options:
          > a. Internet Protocol: Recording:
          > · Select ' HTML based script'
          > · Click on 'HTML Advanced' and select the following
          > i. Script Type: a script containing explicit URLs only
          > ii. Non HTML-generated elements: Do not record
          > b. Internet Protocol: Advanced:
          > i. Clear the 'Reset context for each action' option.
          > ii. Select 'Support Charset' then select 'UTF-8'
          > c. Internet Protocol: Correlation:
          > i. Make sure that you have 'Enable Correlation during recording'
          > ii. Make sure that 'Siebel' is selected. You can expand the list to see
          > the details about each rule if you wish.
          > d. Leave other options as default.
          >
          > 3. Record in the following way:
          > · Record the login in the vuser_init section
          > · Record the Business Process in Action1
          > · Record the logout in the vuser_end section
          >
          >
          > How to record with Siebel Correlation Library
          >
          > Siebel has released a correlation library file, ssdtcorr.dll, as part of
          > the Siebel Application Server version 7.7. This library is available only
          > through Siebel and can be found on siebsrvr\bin directory for Windows
          >
          > Note: The Siebel Correlation API is supported on Windows 2000 and Windows
          > XP only. This implies that if you correlate the script with this method,
          > you cannot replay this script on UNIX platform. If you need to run the
          > script on UNIX platform, use the VuGen Native Siebel Correlation method.
          >
          > The library file, ssdtcorr.dll, must be available to all machines where a
          > Load Generator, Controller, or Tuning Console resides.
          >
          > Steps to record with Siebel correlation library:
          >
          > 1. Copy ssdtcorr.dll into the <LoadRunner>\bin directory of Controller /
          > Tuning Console, and ALL Load Generator machines
          >
          > 2. From the 'New Multiple Protocol Script' window, add 'Siebel-Web' and
          > click OK.
          >
          > 3. Set the following Recording Options:
          > a. Internet Protocol: Recording:
          > · Select 'HTML based script'
          > · Click on 'HTML Advanced' and select the following
          > i. Script Type: a script containing explicit URLs only
          > ii. Non HTML-generated elements: Do not record
          > b. Internet Protocol: Advanced:
          > i. Clear the 'Reset context for each action' option.
          > ii. Select 'Support Charset' then select 'UTF-8'
          > c. Internet Protocol: Correlation:
          > i. Delete the default 'Siebel' correlation rule
          > ii. Click on 'Import', the 'Import correlation Settings from a file'
          > window opens.
          > iii. Navigate to <LoadRunner>\dat\webrulesdefaultsetting directory, select
          > 'WebSiebel77Correlation.cor' and click 'Open'
          > iv. On the 'Confirm Rule Replacement' window, select 'Overwrite'
          > Note: To revert back to the default correlation, delete all of the
          > Siebel rules and click 'Use Defaults'.
          > d. Leave other options as default.
          >
          > 4. Record in the following way:
          > · Record the login in the vuser_init section
          > · Record the Business Process in Action1
          > · Record the logout in the vuser_end section
          >
          > Note: After using the Siebel Correlation Library, a script may throw
          > errors when run for multiple iterations. This is because the server caches
          > some of the data after the first iteration and on the second iteration some
          > of the data does not return from the server. The solution is to record the
          > business process twice. First time record it into vuser_init and then into
          > Action. This is actually the way Siebel is using Load Runner and this is
          > the recommended way to script Siebel.
          >
          > Replaying Siebel script – Run-Time Settings
          > Make sure that "Simulate a new user on each iteration" is not selected in
          > the Browser Emulation options.
          > Common Replay Errors
          >
          >
          > Error: "We detected an Error which may have occurred for one or more of the
          > following reasons: We are unable to process your request. This is most
          > likely because you used the browser BACK or REFRESH button to get to this
          > point."
          >
          >
          > Diagnosis: A HTTP request has been sent twice to the server. This could be
          > an individual web_url request or part of the resources being downloaded
          > from another request. When sending the second request to the server, the
          > Siebel 7.x server detects multiple requests and thus, issues the above
          > error.
          >
          > Example:
          > The following is a sample HTML-based script. Even though "start.swe3" is a
          > frame within step "start.swe2," you can see that an additional request is
          > generated for "start.swe3" because of the "wait.html" step. On replay, the
          > server may reject the second request, "start.swe3," since it is the same
          > for the HTTP call generated by "start.swe2." This may be due to the
          > SWECount or SWEC.
          >
          > web_submit_data("start.swe2",
          > "Action=http://64.242.155.45/callcenter/start.swe",
          > "Method=POST",
          > "RecContentType=text/html",
          > "Referer=http://64.242.155.45/callcenter/start.swe?SWECmd=Start",
          > "Mode=HTML",
          > ITEMDATA,
          > "Name=SWEUserName", "Value=sadmin", ENDITEM,
          > "Name=SWEPassword", "Value=sadmin", ENDITEM,
          > "Name=SWENeedContext", "Value=false", ENDITEM,
          > "Name=SWEFo", "Value=SWEEntryForm", ENDITEM,
          > "Name=SWETS", "Value=1024549479671", ENDITEM,
          > "Name=SWECmd", "Value=ExecuteLogin", ENDITEM,
          > "Name=SWEBID", "Value=-1", ENDITEM,
          > "Name=SWEC", "Value=0", ENDITEM,
          > LAST);
          >
          > web_url("wait.html",
          > "URL=http://64.242.155.45/callcenter/wait.html",
          > "TargetFrame=", "Resource=0","RecContentType=text/html","Referer=",
          > "Snapshot=t6.inf","Mode=HTML",
          > LAST);
          >
          > web_url("start.swe3",
          > "URL=http://64.242.155.45
          >
          > /callcenter/start.swe?SWEFrame=top._swe&_sn={Siebel_sn_body3}&SWECmd=GetCachedFrame&SWEC=1",
          > "TargetFrame=", "Resource=0",
          > "RecContentType=text/html",
          > "Referer=http://64.242.155.45/callcenter/start.swe",
          > "Mode=HTML",
          > LAST);
          > Solutions:
          >
          > 1. Change the Mode in "start.swe2" to "Mode=HTTP"
          >
          > The idea behind changing the mode from HTML to HTTP is to avoid
          > parsing the HTML page that is returned by the server, so that
          > resources are not downloaded. This helps to avoid multiple downloads
          > of same request.
          >
          > If the script still fails on the first iteration, go to step 2. If
          > the script fails on the second iterations onward, go to step 3.
          >
          >
          > 2. Disable the Run-Time Viewer
          >
          > If the script still fails on the first iteration after the change
          > from step 1, try to close the Run-Time Viewer. This option is in
          > VuGen's Tools General Options Display tab; clear the "Show Browser
          > during Replay" option. For more information about this, refer to
          > Problem ID 17234 - Errors in Web replay because of conflict with the
          > runtime browser.
          >
          > If problem persists, refer to step 4
          >
          >
          > 3. Correlate SWECount or SWEC
          >
          > If you are able to run the first iteration, but the script fails on
          > the second iteration or onwards, you will need to correlate SWECount
          > (7.0.3) or SWEC (7.0.4) from the previous step "start.sweXXX." For
          > information about correlation, refer to Problem ID 11806 - What is
          > correlation and how is it done.
          >
          > If problem persists, refer to step 4.
          >
          >
          > 4. Run the script with the extended log
          >
          > If none of the above helps, replay the script with the extended log
          > and identify the HTTP request that is being downloaded multiple
          > times. Search for a similar HTTP Request being sent earlier in the
          > execution log. Once you locate the same, set "Mode=HTTP" so that the
          > resources for that request are not downloaded, and try replaying the
          > script again.
          >
          >
          >
          >
          >
          >
          > Sumita Haldar
          > <haldarsumita@gma
          > il.com> To
          > LoadRunner@yahoogroups.com
          > 01/27/2005 02:53 cc
          > AM
          > Subject
          > [LoadRunner] issues with load
          > Please respond to runner
          > LoadRunner@yahoog
          > roups.com
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          > Hi,
          >
          > we are facing following problems...
          >
          > 1. A script which passes in the VU Gen, fails in the Controller.
          > The
          > error being encountered is that the Siebel Star Array variable is not
          > found and it results in a Content Check error. Not all scripts, for
          > all iterations fail in this manner. It's around 20% of the scripts
          > which give this error.
          > 2 What is RelFrame Id? What are the values that get recorded and
          > how and why?
          > The RelFrameId that is being captured while recording is 1.2.1. When
          > replayed, the script throws a warning that 'Buffer for RelFrameId was
          > not received' and there is a subsequent error message for the SWE
          > Count for which the RelFrameId is set to 1.2.1When this RelFrameId is
          > manually changed to 1.1.1, the script works perfectly fine. The
          > RelFrameId which is being captured at other places has values of 1 or
          > 2. If there is more clarity on what RelFrameId is and what it does,
          > any subsequent errors that get thrown up can be tackled better.
          >
          >
          > thanks,
          > sumita
          >
          >
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
          >
          > ________________________________
          > Yahoo! Groups Links
          > To visit your group on the web, go to:
          > http://groups.yahoo.com/group/LoadRunner/
          >
          > To unsubscribe from this group, send an email to:
          > LoadRunner-unsubscribe@yahoogroups.com
          >
          > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.