HomeSUPPORT QUESTIONS

Need help with StresStimulus? Start here.

Parameter with random date Messages in this topic - RSS

Unregistered User
Unregistered User
Posts: 514


11/14/2018
Unregistered User
Unregistered User
Posts: 514
Is there a way to parametrize the data to choose random times and dates?

We ran into the issue where the script would only create about 10 orders since it was running out of time for that chosen date and time frame.
0 link
George @StresStimulus
George @StresStimulus
Administrator
Posts: 566


11/14/2018
George @StresStimulus
George @StresStimulus
Administrator
Posts: 566
Yes, this can be done.
I assume that you need to parameterize date/time recorded in request(s).

Generally, parameterization includes 2 steps:
A. Creating a variable
B. Replacing the recorded request value with a variable.

Here are the details:
A. To create random times and dates you can use a Data Generator variable described http://support.stresstimulus.com/display/doc49/Data-Generators
  • Select the data generators node on the Test Workflow Tree.
  • Click Create New Data Generator to bring up the generator dialog.
  • Select DateTime type on the left
  • Select Min and Max values.
  • Enter a format string that you want the generator DateTime to look like. For a list of formats see https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings










  • B. To create a parameter see http://support.stresstimulus.com/display/doc49/Creating+a+Parameter
    0 link
    warnerjonn
    warnerjonn
    Posts: 1


    7/1/2020
    warnerjonn
    warnerjonn
    Posts: 1
    Try with C# date and Time


    private Random gen = new Random();
    DateTime RandomDay()
    {
    DateTime start = new DateTime(1995, 1, 1);
    int range = (DateTime.Today - start).Days;
    return start.AddDays(gen.Next(range));
    }
    0 link






    Copyright © 2024 Stimulus Technology