Parameterization : Input Files

Input Files

Input Files can be used to extract variables from a text file, such as a username and a password per simulated user, assigned to a login form. However, the functionality of input files is generic, which means that variables for any purpose can be extracted.

Click the Add Input File… button inside the Var Handler to define a new Input File and enter a simple file name without a directory path. Please note that this action creates only the input file definition but that it does not create the input file itself on disk. This means that the input file must also exist on disk and that it must be placed inside the same Project Navigator directory where the load test program is stored.

You can create the input file on disk before, or during, or after the definition is made - or you can also copy an existing file to the corresponding Project Navigator directory.

Please note that the name of the input file should have the file extension

  • .txt (recommended) or

  • .dat

Input File Options

Option Name

Purpose

Option Name

Purpose

File Scope

Defines the scope of the variables which will be (later) extracted from the Input File:

  • global (one-line)

this scope is usually not useful for Input Files because only one line will be read during the entire load test at the start of the test.

  • new line per user

a new line will be read for each simulated user during the load test. This is the proper scope for reading user account data (username/password). The line remains the same for all executed loops of the same user.

  • new line per loop

a new line will be read each time a simulated user executes a loop. The new lines are distributed over all users and loops.

  • NL per inner loop

a new line will be read each time a simulated user executes an inner loop. The new lines are distributed over all users, loops, and inner loops.

Line Order

Controls whether the lines are read in sequential or randomized order.

Comment Tag

Defines a "start character" or a "start string" for commented-out lines. Such lines will be ignored during the load test.

Var Delimiter

Defines the "variable delimiter character" that separates values on the same line (several values/variables can be extracted from the same line).

Trim Extracted Values

Control whether blank characters (white spaces) are removed from the start and the end of the extracted variables.

EOF Action

Controls the behavior when all lines from the Input File have already been read when a new line is requested:

  • reopen file

the file is re-opened. If a randomized line order was set, the lines continue to be randomly read in a new order.

  • stop load test

the load test will be immediately aborted. This option can be used to avoid duplicate logins with the same username/password when fewer lines are available than users, which should be simulated. Note that EOF can also become true for a randomized line order because the lines are first mixed while opening the file and then read.

Text Input Details

Line Column #

 

the column number (of a line) from which the variable is extracted (1, 2, 3 ..)

Var Name

any new variable name, but with the following naming restrictions:

  • The name can only contain the characters A..Z, a..z, 0..9, and _. Spaces are not permitted.

  • The name must not start with an underline character _

Next, you should test to ensure that the parsing of the Input File works correctly.

This can be done by clicking the Input File button for an Input File definition:

Afterward, you can extract variables from the Input File by clicking one or more times on the variable extractor icon: 

Variable Created from Input File Result:

Input File Example

The following example shows the definition of an Input File, (first) without the assignment of variables:

The black x’s next to the “password“ and “username“ are the names of the extracted variables that came from Columns 1 & 2 of the “userAccounts.txt” input file, respectively. Click these X’s when you want to remove the variables. The variable scope is shown in brackets next to the title text.

The blue left arrow indicates that the value of the variable has been extracted. More details about how the variable was extracted can be displayed by clicking on the corresponding magnifier icon.

A variable, or the Input File definition itself, can be deleted by clicking on the black X.

The Input File definition can be displayed and modified by clicking on the edit icon next to the filename.

 

Can't find what you're looking for? Send an E-mail to support@apica.io