Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

File parsing in a stress environment

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
I am doing a bunch of HTTP tests and trying to get SOA working as a pure HTTP client. I want to run my .tst file in multiuser scenario. Here is the description of what I am trying to test. When a HTTP request receives the response , I want to examine the response for some pre-defined patterns. Let us say that my approach is to write the response to a file. When I run this .tst in a multiuser scenario with say 5 users ( processes ? ) , the 5 users will overwrite the file and I dont have proper control over which file is being read.

I can think of two options

1. I can associate a process-id to a file being written and tell my method to read the file associated with the process id.

2. I can simply read streamed responses , store it as a variable in a buffer and read the buffer after which I would want to store the response in a unique file.


Can someone guide me in this regard with some relevant code snippets.

I am attaching a small script in this post to provide the proper context.

In this script , I am looking for the pattern "cookie" in the page 1.htm. But when there are multiple users , the 1.htm page may be overwritten or previously created files are examined. I want to be able to ensure that unique files are created for various processes and a process reads only the file that it creates.

Thanks in advance.


Niranjan

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options

    I am doing a bunch of HTTP tests and trying to get SOA working as a pure HTTP client. I want to run my .tst file in multiuser scenario. Here is the description of what I am trying to test. When a HTTP request receives the response , I want to examine the response for some pre-defined patterns. Let us say that my approach is to write the response to a file. When I run this .tst in a multiuser scenario with say 5 users ( processes ? ) , the 5 users will overwrite the file and I dont have proper control over which file is being read.

    I can think of two options

    1. I can associate a process-id to a file being written and tell my method to read the file associated with the process id.

    2. I can simply read streamed responses , store it as a variable in a buffer and read the buffer after which I would want to store the response in a unique file.


    Can someone guide me in this regard with some relevant code snippets.

    I am attaching a small script in this post to provide the proper context.

    In this script , I am looking for the pattern "cookie" in the page 1.htm. But when there are multiple users , the 1.htm page may be overwritten or previously created files are examined. I want to be able to ensure that unique files are created for various processes and a process reads only the file that it creates.

    Thanks in advance.


    Niranjan

    Hi Niranjan,

    Correct me if I am understanding your question wrong. From what I understand, your main dilemma here is making sure that a process reads only the file that it creates, and not some other files that another user just created? My suggestion for this would be to chain a method tool to the test (just as you had done). But instead of having that method tool read from the file you just created from the Write File tool, you can have the method tool generate the file for you. Then within that same Method tool, write a script that look for the pattern in the file you just created. To ensure that no files are overwritten, I recommend having the method name the files based on the time and date that they were created.

    Please feel free to contact soatestsupport@parasoft.com for a more detailed implementation of this.
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Thank you. Your statement of the problem was accurate. I did think about the date-stamp solution , but I was wondering if there is any way I can associate the filename with the test i am running. Is the script name available as some global parameter that a method can access ?
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hi Niranjan,

    Can you send an email to soatestsupport@parasoft.com so that we may contact you directly and speak to you? I'm a little confused regarding the last post. I had understood that the multiple users was referring to when you are running load test. When you say "associate the filename with the test i am running", are you referring to the "x" part of the file name x.tst?