Description

The RealtimeTestReceiver creates request headers and payload, passes generated data to the given target, and upon receiving a response, stores the response payload to a file. This Receiver requires an XML configuration file to read the request URL and header metadata to create request headers.


In This Article


Component Diagram

The following component diagram shows the relationships between the GenRocket components, starting with a Scenario whose primary Domain uses the RealtimeTestReceiver. 



Sequence Diagram

The following sequence diagram gives a more detailed sequence of the complete life cycle during the run of a Scenario whose primary Domain uses the RealtimeTestReceiver.



Receiver Parameters

The following parameters can be defined for the RealtimeTestReceiver. Items with an asterisk (*) are required.  

  • configPath* - Defines the location of the configuration file.
  • configName* - Defines the name of the configuration file.
  • responsePath* - Defines the location where the response file will be saved.
  • responseOutput*- Defines where we want to see the response output. 
    • appendFile, singlefile, noFile
  • responseName* - Defines the name of the response file.
  • requestContentType*- Defines the HTTP content type for the request:
    • ANY, TEXT, JSON, XML, HTML, URLENC, BINARY, MULTIPART
  • responseContentType*- Defines the HTTP content type for the response:
    • ANY, TEXT, JSON, XML, HTML, URLENC, BINARY, MULTIPART
  • method*- Defines the request header method type:
    • GET, PUT, POST, DELETE, HEAD, PATCH
  • isPayloadList*- Defines whether to send the generated data in a list:
    • true/false
  • rootElementName - Defines the root element for the generated data to send in the request body.
  • logRequestCount* - Defines the number of requests that are executed before logging a message to the console.
  • threadCount - Defines the number of requests that may be sent simultaneously.


Receiver Attribute Property Keys

Each Domain Attribute will have defined the following property keys

  • aliasName - Enables the user to define a different name for the Attribute.
  • body- Defines if the value of the Attribute should be automatically added to the body:
    • true/false
  • header- Defines if the value of the Attribute will be automatically added to the request header:
    • false/true
  • xmlStyle - Defines how to send the Attribute in XML body:
    • ELEMENT/ATTRIBUTE
  • attributeType - Defines whether the data of Attribute is String/text or a path to the File (FilePath) or bytes of a file (FileBytes) to be sent as Multipart/form-data.


Configuring RealtimeTestReceiver for requestContentType Parameter = MULTIPART

The MULTIPART section for the requectContentType Parameter allows the user to send Multipart-data in the request.



When the MULTIPART requestContentType is selected, POST should be selected for the method Parameter, as it will be sending some data in the request.



Also, add an attributeType column in Attribute Keys. It defines whether the data of Attribute is String/text or a path to the File (FilePath) or bytes of a file (FileBytes) to be sent as Multipart/form-data.



Configuration File

The RealtimeTestReceiver must read from a configuration file to attain the request URL and other request header information. 


The format of the configuration file is as follows:


<config>   
  <requestURL>https://someurl</requestURL>
  <headers>
    <header type="constant" name="Accept-Encoding">compress, gzip</header>
    <header type="timestamp" format="yyyyMMdd" name="Accept-Datetime"/>
    <header type="UUID" name="If-Match"/>
  </headers>
</config> 


Dynamic URL in requestURL

A static or dynamic URL can be provided within the requestURL in the configuration file. A dynamic URL allows the value to change for each request. 


A user can add any Attribute in the URL by enclosing it in #{ }, and the value will be replaced with the Attribute. 


In the example below, a firstName and lastName Attribute have been included in the requestURL and those values will be read from the Attributes. 


https://someurl/#{firstName}/#{lastName}


A sample configuration file is shown below: 


<config>   
  <requestURL>https://someurl/#{firstName}</requestURL>
  <headers>
    <header type="constant" name="encryption">true</header>
    <header type="timeStamp" format="yyyyMMddHHmmss" name="timestamp"/>
    <header type="UUID" name="requestId"/>
  </headers>
</config> 

Header Element Types

The Receiver configuration supports three header types:

  • constant - allows the user to define constant header information with the given name and static value.
  • timestamp - tells the Receiver to add a timestamp to the header with given name and format.
  • UUID - tells the Receiver to add a UUID to the header with the given name.

An Attribute whose header propertyKey value is set to true will automatically have the alias, and the value of the Attribute added to the header. 


User Story

The user wants to test the login function of the given application.

  • The request URL is defined to be the following:
  • The request header requires the following map of information:
    • encryption = true
    • timestamp = yyyyMMddHHmmss
    • counter = incrementing value
    • requestId = UUID
  • The User defines the following configuration.

 

<config>   
  <requestURL>https://someurl</requestURL>
  <headers>
    <header type="constant" name="encryption">true</header>
    <header type="timeStamp" format="yyyyMMddHHmmss" name="timestamp"/>
    <header type="UUID" name="requestId"/>
  </headers>
</config> 


  • The user elects to generate test data via the project's User Domain
  • The User Domain has the following attributes:
    • id
    • firstName
    • lastName
    • username
    • password 
  • The payload only requires the username and password.
  • The user attaches the RealtimeTestReceiver to the Domain.
  • The user sets the propertyKey values for each Attribute as follows:
    • id alias:id, body:false, header:false
    • firstName alias:firstName, body:false, header:false
    • lastName alias:lastName, body:false, header:false
    • username alias:username, body:true, header:false
    • password alias:password, body:true, header:false
  • The request header will need a special parameter called counter, with an increasing value each time a request is made. The user adds an Attribute to the Scenario User Domain, called counter, and assigns it a RangeGen Generator with a start range of 1.
  • The user sets the propertyKey values for the counter as follows:
    • counter alias:counter, body:false, header:true
  • The user creates a Scenario.
  • The user downloads the Scenario.
  • The user runs the Scenario.
  • The RealtimeTestReceiver processes the generated data.
  • The RealtimeTestReceiver creates the request headers.
  • The RealtimeTestReceiver creates the request payload.
  • The RealtimeTestReceiver makes a request with the request header and request payload.
  • The RealtimeTestReceiver receives the response payload.
  • The RealtimeTestReceiver save the response payload to a file.