Proposal

The following article is a Phase I proposal for a new GenRocket Receiver, the RealtimeTestReceiver. 


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 request URL and header metadata in order to create request headers. 


Component Diagram

The following component diagram shows the GenRocket components relationships 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.


Parameters

The RealtimeTestReceiver requires the following parameters to be defined:

  • 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.
  • responseName - Defines the name of the response file.
  • method - Defines the request header method type:
    • GET, PUT, POST, DELETE, HEAD, PATCH
  • requestContentType - Defines the HTTP content type for the request:
    • ANY, TEXT, JSON, HTML, URLENC, BINARY
  • responseContentType - Defines the HTTP content type for the response:
    • ANY, TEXT, JSON, HTML, URLENC, BINARY
  • 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.

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

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="static" name="Accept-Encoding">compress, gzip</header>
    <header type="timeStamp" format="yyyyMMdd" name="Accept-Datetime"/>
    <header type="UUID" name="If-Match"/>
  </headers>
</config> 


Header Element Types

For phase I of the release, the Receiver configuration will support three header types:

  • static - allows the user to define static 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. 


Phase II Special Notes

In a phase II release of this Receiver, the configuration file will also contain information to allow the Receiver to execute one or more assertions from information attained from the payload response.


Story

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

  • The request URL is defined to be 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="static" 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, so 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.