SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Nov 2004
    Location
    Bangalore
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Writing correlated values to a txt file

    1. What version of LoadRunner (LR) or PerformanceCenter (PC) are you using? (specify which tool LR or PC)
    8.1 version
    2. What is the protocol you are recording?
    web/http

    2.1 If .NET, which version of .NET does the app require?
    2.2 If .NET, which version of .NET do you have installed?
    2.3 If OracleNCA with Oracle Forms Server, please list the version of Oracle Forms Server. You can get this info from the main Oracle Form when launched - Help -> About
    N/A


    3. If HTML - are you using HTML-Advanced with URLs or,
    (indicate yes/no)-Y

    4. If URL mode:
    - Concurrent groups, or
    - Without Concurrent groups?
    (indicate which) N/A

    5. Which LoadRunner/PerformanceCenter feature (FPs) or service packs are you using?
    FP4

    6. VuGen Recording - are you using Old or New Recording Engine?
    new

    7. What kind of LoadRunner license do you have -
    - Permanent/Unlimited

    8. If subscription, is subscription current or expired?
    N/A

    9. What platform(s) (PCs) and Operating Systems (Windows-XP, etc.)? Include version and service packs (SP1 or 2, etc.)
    XP,sp2.

    I want to save the data returned by corelation to a txt file. I am able to write to a text file, if I know the number of values returned by the correlation. But when the web_reg_save_param returns different number of values based on the data we enter, I am having a lil trouble in writing them to a file.


    Here is what I tried-

    ################################################## ###########################
    web_reg_save_param("ParamName","LB=abd","RB=def"," ORD=ALL", LAST);

    web_submit_data(XXXXXX);

    for (i=0;i<atoi(lr_eval_string("{ParamName_count}") );i++)
    {
    sprintf(NewParamName, "ParamName_%d", i)
    if((fd1=fopen(filename,"a+"))==NULL)
    {
    lr_output_message("ERROR: Cannot open file for appending %s",filename);
    return -1;
    }
    else
    {
    fprintf(fd1,"%s\n",lr_eval_string(NewParamName));
    fclose(fd1);
    }
    }

    But the fprint does not write the values stored in ParamName_1,ParamName_2, etc..instead writes the actual parameter itself.
    ################################################## ############################

    Any kind of inputs/Suggestions to accomplish this is much appreciated. I dont want to use VTS, as the data sizes are not too big and want to figure out what am I missing in the code.
    Suresh
    Cognizant Technology Solutions
    Bangalore

  2. #2
    Moderator JakeBrake's Avatar
    Join Date
    Dec 2000
    Location
    St. Louis - Year 2025
    Posts
    15,609
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    Refer to runtime settings and turn on logging.

  3. #3
    Moderator
    Join Date
    Aug 2001
    Location
    NC
    Posts
    6,018
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    sprintf(NewParamName, "{ParamName_%d}", i);

    As soon as you add a second user trying to open and use the file in an exclusive write fashion you are going to have programmer introduced contention issues. It will look like a performance problem on the part of your application, but it will be actually a problem with how your script has been designed to access non-application based resources.

    If it is your intention to reuse the values in a different script, then you are out of luck unless you create your own mechanism to address both multi-user contention and exclusive use (read) issues. In essence, build a replacement for VTS.

    If you are simply trying the capture the values for pulling the data from the database later, then you are working far too hard to address this issue. Consider lr_error_message() which will push the values to the controller or consider taking a database snapshot prior to the test for restoration afterward.
    James Pulley

    Replace ineffective offshore contracts, LoadRunnerByTheHour. Starting @ $19.95/hr USD.

    Put us to the test, skilled expertise is less expensive than you might imagine.

    Twitter: @LoadRunnerBTH @PerfBytes

  4. #4
    Junior Member
    Join Date
    Nov 2004
    Location
    Bangalore
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    James/Jake,
    Thanks for your reply.
    My issue is not while running multiple users and actually I wont be running this script with multiple users. I just want to do this with no manual intervention (copying from the logs etc..), as the scripts usually run during our night time and we need these values for other teams before we come in the next day and 'My issue is only in writing the values in to txt file'.

    For e.g.
    ParamName_1 = "Suresh"
    ParamName_2 = "Address 1" etc......
    I want to write the values stored in ParamName_1.ParamName_2, etc...

    Code that I have listed in the post above
    fprintf(fd1,"%s\n",lr_eval_string(NewParamName));

    writes ParamName_1,ParamName_2 instead of Suresh,Address1,.....to the file.

    Please do let me know your thoughts.

    Suresh
    Suresh
    Cognizant Technology Solutions
    Bangalore

  5. #5
    Moderator
    Join Date
    Jan 2006
    Location
    Charlotte, NC
    Posts
    1,600
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    [ QUOTE ]
    sprintf(NewParamName, "{ParamName_%d}", i);

    ...


    [/ QUOTE ]

    As James pointed out, your problem is getting the right format for parameter dereferencing.
    Unless you are writing a compiler, strtok is NOT the answer.
    See: http://www.sqaforums.com/showflat.ph...=541641#542222

    QAF is still an exercise in self-sufficiency! (Thank JB!)

  6. #6
    Junior Member
    Join Date
    Nov 2004
    Location
    Bangalore
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    ptrussell,
    Do you think, there is a quick way to do the dereferencing. Let me know if you know of any other means to accomplish the above objective.

    I appreciate all the inputs so far.

    Suresh
    Suresh
    Cognizant Technology Solutions
    Bangalore

  7. #7
    Junior Member
    Join Date
    Aug 2008
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    Hi Suresh,
    Please try this and let me know if it works?!

    sprintf(NewParamName, "{ParamName_%d}", i);
    sprintf(NewParamNameVal, "", lr_eval_string(NewParamName));
    in the place of
    sprintf(NewParamName, "ParamName_%d", i)
    AND
    fprintf(fd1,"%s\n",NewParamNameVal);
    in the place of
    fprintf(fd1,"%s\n",lr_eval_string(NewParamName));

    Bala

  8. #8
    Moderator
    Join Date
    Jan 2006
    Location
    Charlotte, NC
    Posts
    1,600
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    [ QUOTE ]
    ptrussell,
    Do you think, there is a quick way to do the dereferencing. Let me know if you know of any other means to accomplish the above objective.

    I appreciate all the inputs so far.

    Suresh

    [/ QUOTE ]

    Hi Suresh,

    Not sure what you are looking for.

    char myparm[64];
    char *pval;

    sprintf(myparm, "{MyList_%d}", i);
    pval = lr_eval_string(myparm);

    This is the code that I have used hundreds of times.

    [img]/images/graemlins/cool.gif[/img]
    Unless you are writing a compiler, strtok is NOT the answer.
    See: http://www.sqaforums.com/showflat.ph...=541641#542222

    QAF is still an exercise in self-sufficiency! (Thank JB!)

  9. #9
    Member
    Join Date
    Jun 2008
    Posts
    78
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    Suresh,

    Copy the code below as it is and try. It should work. Let me know if you have any issues.

    char NewParamName[100];
    char NewParamVal[100];


    web_reg_save_param("ParamName","LB=abd","RB=def"," ORD=ALL", LAST);

    web_submit_data(XXXXXX);

    for (i=0;i<atoi(lr_eval_string("{ParamName_count}") );i++)
    {
    sprintf(NewParamName, "{ParamName_%d}", i)
    sprintf(NewParamVal, "%s",lr_eval_string(NewParamName));

    if((fd1=fopen(filename,"a+"))==NULL)
    {
    lr_output_message("ERROR: Cannot open file for appending %s",filename);
    return -1;
    }
    else
    {
    fprintf(fd1,"%s\n",NewParamVal);
    fclose(fd1);
    }
    }

    Regards,
    Prashanth.

  10. #10
    Junior Member
    Join Date
    Aug 2008
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Writing correlated values to a txt file

    Hi suresh,

    Try this...

    char *pParamName;
    int nCount;

    web_reg_save_param("ParamName","LB=abd","RB=def"," ORD=ALL", LAST);

    web_submit_data(XXXXXX);

    nCount=atoi(lr_eval_string("{ModelID_count}") );

    for(i=1;i<=nCount;i++)
    {
    pParamName=lr_paramarr_idx("ParamName",i);
    strcpy(aParam[i],pParamName);

    if((fd1=fopen(filename,"a+"))==NULL)
    {
    lr_output_message("ERROR: Cannot open file for appending %s",filename);
    return -1;
    }

    else
    {
    fprintf(fd1,"%s\n",pParamName);
    fclose(fd1);
    }

    }

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 8.82%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:42 PM.

Copyright BetaSoft Inc.