Description

The ImageReceiver creates an image file that is saved to disk. The image can be a GIF, JPEG, PNG, TIF, or TIFF. Attributes are used to determine the other properties of the image, which are: 

  • width
  • height
  • text
  • textColor
  • fontType
  • backgroundColor
  • fileIndex


In This Article


Receiver Parameters

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

  • contentType* - Defines the contentType of the image. Options include:
    • GIF
    • JPEG
    • PNG
    • TIF
    • TIFF

  • path* - Defines the path to save the image file to.
  • subDirectory* - Defines the subdirectory name under the outputPath.
  • filesPerDirectory* - Defines the number of files to be generated per output subdirectory.
  • fileNamePrefix - Defines what the file name should start with. The suffix is defined by the fileIndex property key.


Receiver's Attribute Property Keys

The Receiver defines one property key that can be modified on any of its associated Domain Attributes:

  • width - Determines if the Attribute should be used to define the width of the image. 
  • height - Determines if the Attribute should be used to define the height of the image. 
  • text - Determines if the Attribute should be used to define the text of the image. 
  • textColor - Determines if the Attribute should be used to define the text color of the image. Valid colors are: 
    • black
    • blue 
    • cyan
    • green
    • gray
    • magenta
    • orange
    • pink
    • red
    • white
    • yellow
  • fontType - Determines if the Attribute should be used to define the font type of the image. The font can be any valid font installed on the system executing the Scenario.
  • textSize - Determines if the Attribute should be used to define the text size on the image (in points). 
  • backgroundColor - Determines if the Attribute should be used to define the background image. Valid colors are: 
    • black
    • blue 
    • cyan
    • green
    • gray
    • magenta
    • orange
    • pink
    • red
    • white
    • yellow
  • fileIndex - Determines which Attribute is used for the file index. The file index is written directly after the fileName. For example, given a file name of "image." a file index starting at "1," and a content type of PNG, the file name would be image-1.png.


Use Case 1: Generate Different Colored Images with Full Name

A tester wants to generate 100 GIF images containing full names. Generated images will be 300 x 300 and have different background colors. Additionally, the font type will vary in each generated image. 



Initial Project Setup

A Project has been created with one Project Version, which contains the following: 

  • A User Domain with the loopCount set to 100. 
  • The ImageReceiver has been assigned to the User Domain
  • A Scenario has been added to the User Domain.


Attribute Name

Purpose

Assigned Generator

fullName
Generates a full name as the text for each image.FullNameGen
backgroundColorDetermines image background color (yellow, cyan, green, and gray).ListGen
widthSets the width of each generated image to 300.ConstantGen
heightSets the height of each generated image to 300.ConstantGen
fontDetermines font type for each generated image (Arial, Verdana, Comic Sans MS, and Courier New).ListGen
fontSizeSets the font size to 16 for each image.ConstantGen



ImageReceiver Parameters

The fileNamePrefix Parameter has a value of "image." Remember to click the Save button after making any changes to Receiver Parameters.


id Attribute Property Keys

The id Attribute will be used as the file name suffix for each generated JPEG image. Select the id Attribute and change the fileIndex property key value to "True."


Since the fileNamePrefix Parameter was set to "image" for the ImageReceiver, each file will contain the word "image" combined with the "id Attribute value." Example: image1.gif.



fullName Attribute Property Keys

The fullName Attribute will be used for the text in each generated image. Select the fullName Attribute and change the text property key to "True." 



backgroundColor Attribute Property Keys

The backgroundColor Attribute changes the background color between yellow, cyan, green, and gray. Select the backgroundColor Attribute and change the backgroundColor property key to "True."



width Attribute Property Keys

The width Attribute sets the image width to "300." Select the width Attribute and change the width property key to "True."



height Attribute Property Keys

The height Attribute sets the image height to "300." Select the height Attribute and change the height property key to "True."



font Attribute Property Keys

The font Attribute sets the font type to Arial, Verdana, Comic Sans MS, or Courier New.  Select the font Attribute and change the fontType property key to "True."



fontSize Attribute Property Keys

The fontSize Attribute sets the font size of the text to "16." Select the fontSize Attribute and change the fontSize property key to "True."



Download and Run the Scenario 

Download the Scenario by clicking the Cloud icon in the Project Dashboard or the Domain Dashboard



Open a Command Prompt or Terminal window and run the following command at the command line to generate the images. 


genrocket - r <ScenarioName.grs>


Replace <ScenarioName.grs> in the command line with the actual name of the Scenario.


genrocket -r UserScenario.grs


Sample Output

100 GIF Images files have been generated in this example. Each image has a different background color and text. The text type varies per generated image, and the text size is "16.". 



Sample Image 1


Sample Image 2



Sample Image 3


Sample Image 4