In this section:

Introduction

The Data Learning tool is used to incrementally extend a virtual asset's reach to cover a broader range of use cases. It automatically expands the data set by observing traffic and adding net new observations to the data repository—enabling teams to rapidly enhance data-driven virtual assets. The update process can be fully-automated (invoked whenever new data is detected, via the File Event Listener Marketplace tool) or initiated on an as-needed basis (via provisioning actions).

Requirements

This tool requires access to a Virtualize Server with version 9.9.5 or later; the tool itself can be used on Virtualize 9.9.0 or higher.

Installation

This tool is implemented as datalearningtool.jar. You can install the tool from the UI or the command line.

UI Installation

  1. Choose Parasoft > Preferences and click System Properties.
  2. Click Add JARs and browse for the datalearningtool.jar.
  3. Click Apply and restart Virtualize.

Command Line Installation

Add the datalearningtool.jar file to the system.properties.classpath property in your localsettings properties file. For example:

system.properties.classpath=<path to jar>/datalearningtool.jar

Usage

You can add the tool as a provisioning action if you want to invoke it as needed or integrate data learning into the test environment provisioning process with Continuous Testing Platform. 

  1. Add a .pvn file to the project (see Defining Provisioning Actionsand right-click the Action Suite node.

  2. Choose Add New> Action and choose Data Learning Tool from the Add Action wizard.
  3. Click Finish and configure the tool (see Configuration).

If you want it to run automatically whenever new or updated traffic is detected in a specific traffic file directory, chain the tool to the outgoing response of a Message Responder and ensure that the associated virtual asset is configured with the File Event Listener (visit the Parasoft Marketplace to download the File Event Listener). For File Event Listener configuration details, see the File Event Listener documentation.

In both cases, the tool will do the following once it is triggered:

  • Scan the specified local directory for new or modified traffic files whose names match a specific pattern.
  • If matching traffic files are found, use the specified Virtualize Server to process that traffic according to the settings defined in the designated template file.
  • Import the identified data into the designated Data Repository.

Configuration

The tool is configured by setting the following options.

Source Traffic Settings

These options control how the tool identifies and processes traffic files.

Directory to Scan for Traffic Files

Specify the local directory to scan for traffic files. The directory is relative to the Data Learning tool. If the tool is deployed in a .pva that is deployed in "VirtualAssets", it is relative to "VirtualAssets". If the tool is in a .pvn in another project, the path is relative to that other project.

Traffic File Pattern

(Optional) If you want to process only specific traffic files in the above directory, specify a pattern that indicates which traffic files you want to include. You can use * and ? wildcards.

Template File

Specify the location of the Virtualize configuration template you want to apply to guide the traffic processing. If the tool is deployed in a .pva that is deployed in "VirtualAssets", it is relative to "VirtualAssets". If the tool is in a .pvn in another project, the path is relative to that other project.

Character Encoding

(Optional) Specify the character encoding for the tool. Default is UTF-8.

Data Reuse

(Optional) If you want to override the data reuse settings specified in the template file, specify the desired reuse option.

Remote Server Settings

These options specify which Virtualize Server should process the traffic files.

Use Remote Server (Default: false)

Enter true to configure the tool to use the settings specified in the tool configuration settings. Enter to false process the traffic files on the local server using the local desktop license. Default is false.

Host

Specify the host of the Virtualize Server that should process the traffic files.

Port (Default: 9080)

Specify the port of the Virtualize Server that should process the traffic files. Default is 9080.

UsernameSpecify a username for authenticating with this Virtualize Server.
PasswordSpecify a password for authenticating with this Virtualize Server.
Upload Path (Relative to VirtualAsset)

Specify where on this Virtualize Server to upload the files that are used to identify and process new traffic. This directory should be relative to the Virtualize Server's VirtualAssets project. This setting is optional.

Data Repository Settings

These options specify what Data Repository the new/updated data should be imported into. If you do not specify a host, all Data Repository settings will be taken from the template specific in the Source Traffic tab.

Host

Specify the host of the Data Repository Server where the new/updated data should be imported.

Port

Specify the port of the Data Repository Server where the new/updated data should be imported. The default is 2424.

UsernameSpecify username for authenticating with this Data Repository Server.
PasswordSpecify a password for authenticating with this Data Repository Server.

Logging

This option specifies the level of logging detail that is recorded.

Log Level

Specify how much information you want logged to the console and the Event Monitoring view. The default is 2 (warn).

If the tool is used in a .pva, information will also be logged to the Event Details perspective. Informational events are logged to the Console if the log level is greater than 3. The events are logged to the Event Log if the log level is greater than 4.

Running the Examples

The zip file that you downloaded from Marketplace provides several example configurations and exercises for using the Data Learning tool. The examples show you how to deploy the tool as a tool directly in a Provisioning Action (pvn) and as a tool chained to a Message Responder in a Virtual Asset (pva).

Using the Tool Directly

  1. Copy the following files to a project within your workspace (such as ProvisioningAssets):
    • DataLearner.pvn
    • DataLearner_1.txt
    • DataLearner_2.txt
    • DataLearningExample.traffictemplate
  2. Invoke the .pvn by either running it directly in the Virtualize UI or through CTP. The tool will scan the directory for the traffic template and DataLearner_*.txt traffic files, importing data from them into the Data Repository on localhost.

Using the Tool Chained to a Responder

  1. Deploy DataLearner.pva as a Virtual Asset in Virtualize at the HTTP path: /DataLearner.
  2. Copy DataLearner_1.txt and DataLearner_2.txt to VirtualAssets/traffic_files/ on the Virtualize server where the DataLearner Virtual Asset is deployed.
  3. Copy DataLearnerExample.traffictemplate to VirtualAssets/traffic_templates/ on the Virtualize server where the DataLearner Virtual Asset is deployed.
  4. (Optional) Update the Environment in DataLearner.tst to point to the correct Virtualize host.
  5. (Optional and recommended) Start Monitoring the DataLearner Virtual Asset.
  6. Run DataLearner.tst. This test invokes the DataLearner Virtual Asset over HTTP, causing the chained Data Learning Tool to run. The chained tool uses the traffic template and traffic files that were copied in steps 2 and 3.
  7. Note events reported to the Virtualize Event Log and that the traffic files are deleted from traffic_files when done.

Using a Message Proxy to Record Transactions

  1. Create a Message Proxy and add a connection (see Creating Proxies).
  2. Configure the connection to use a unique traffic file pattern (i.e., %n) and enable the New session file for each message pair option.
  3. Make sure the Data Learning Tool is configured to scan the directory to which the Proxy Connection will record. Relative paths in the Data Learning Tool configuration are relative to the .pva or .pvn that contains the tool.
  4. Record traffic normally through the Message Proxy.
  5. Run the Data Learning Tool to process recorded transactions.

Data Learning Tool Use Case

If a virtual asset doesn't know how to respond to a given request, you can record the request and its corresponding response from the live service or local server and add it to the Data Repository. The next time the virtual asset receives that same request, the appropriate response will be returned.

Workflow

In a typical proxy configuration, a connection forwards a request to a virtual asset. If the asset knows how to respond to the request, the response from the associated repository will be returned to the client.

If the virtual asset does not know how to respond to a given request, an error message will be returned to the client and no additional action will be taken.

You can configure Virtualize so that the request and corresponding response will be recorded and added to the Data Repository (see Configuration below). The following outline describes the overall process for "teaching" a virtual asset how to respond to new requests.  

  1. The virtual asset fails to respond.
  2. The request is sent to the live system, which is configured as the proxy's secondary connection. 
  3. The corresponding response is returned to the client and the request and response are recorded in a traffic file.
  4. The traffic file creation/update triggers the virtual asset's File Event Listener, which invokes the responder with the Data Learning tool.

  5. The Data Learning tool sends the traffic file to the designated Virtualize Server, which then uses the designated template file to process the traffic and add it to the Data Repository.

  6. The next time that this request is received, the virtual asset will return the recorded response.

Configuration

  1. Configure the Message Proxy's primary connection to forward to the virtual asset.
  2. Configure the Message Proxy's secondary connection to forwards to the live virtual service.
  3. Enable the Record on secondary connection only and New session file for each message pair options for the Message Proxy.


     
  4. Configure the virtual asset to use the File Event Listener as a Custom Transport and configure the listener to monitor the directory where the proxy will save traffic files.


     
  5. Add a responder with a Data Learning Tool chained to it to the .pva associated with the virtual asset.  
  6. Configure the tool to add data to the Data Repository that originally did not have the request/response.
  • No labels