Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Automated Testing LS 9.6.1

Hello, everyone.

The situation is the followig.

I want to use Generator of data for automated testing of my survey, which contains Merged fields.

So, I do the following for the gender value

Test -> Generate data -> Defined Values -> for a gender value


Begin Unverified Perl

return VALUE("MFxGENDER");

End Unverified



where MFxGENDER - the value of the gender for the particular password from merged fields. But, it seems to me it doesn't work.

The next issue is that I want to indicate id range , i.e. 1-10, but each time generate not a random value, but make the program do it value by value: 1,2,3,4,5,6,7,8,9,10.

Thank you in advance,
Vasyl
asked Mar 19 by Vasyl Bronze (725 points)
edited Mar 19 by Vasyl
For the second issue, try this defined value:

Begin Unverified Perl
my $mod = RESPNUM() % 10;
if ($mod == 0) {
    $mod = 10;
}
return $mod;
End Unverified
Dear Zachary, many thanks for your reply. You always find the time to help other people!

I am afraid this code will not help me. I am sure that RESPNUM() function will not return proper value until id is entered.

Thus, I had to come up a different approach.

1. I have created the file password.txt with one row with  the value of the first id = 1.
2. Then, I have put this code to the defined value for id


[% Begin Unverified Perl

# This file documents Tie::File version 0.98
use Tie::File;
tie my @array, 'Tie::File', my $filename = 'path to password.txt' or die $!;

# return the value of the first id
return $array[0]; 

End Unverified %];



This code is supposed to enter the first password id=1.

3. Then I have put this code to the defined value forthe next field


[% Begin Unverified Perl

# This file documents Tie::File version 0.98
use Tie::File;
tie my @array, 'Tie::File', my $filename = 'path to password.txt' or die $!;

# the array of passwords, starting from the second
my @idArray = (2,3,4,5,6,7,8,9,10);

# respondent number
my $respNum = RESPNUM(); 

# this will write the next id to the first row of the txt file
$array[0] = @idArray[$respNum-1];

End Unverified%]



This code is supposed to write the  next id  to the txt file, so the next respondent  will enter the survey with the proper id.

Thsi approach allows to perform automated testing entering id one by one.

Sincerely,
Vasyl

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.
...