Printer FriendlyEmail Article Link

Spirent Studio Security: Importing/Exporting CSV Files (API)

Environment/Versions

Platform Mu-4000 / Mu-80x0 

Version 6.5.x

Answer

Importing/Exporting CSV Files (API)

You can use Test Set API commands to export existing Test Sets to comma-separated-value format (.csv) and to import test cases in .csv format into the Mu system (for details on the required .csv format, see Test Set CSV Format).

The following REST examples use cURL (www.curl.haxx.se), a command line tool for transferring data with URL syntax, to construct the request. To run these commands in your own testing environment, you must use the IP address of your Mu appliance and a valid username/password for the Mu system.

Exporting to CSV

To export a Test Set to .csv:

curl -k -b cookie_jar -u user:pass https://mu-ip/api/v5/ddt/session/test/export/csv/uuid/285d6b48-3ef6-40e2-b7be-a2e93ccf628f

Importing From CSV

Importing a .csv file also saves the Test Set as a template in the Mu system—or updates an existing Test Set template if the UUID already exists. Before importing, ensure that the Options referenced in the .csv file are defined within the Scenario loaded for the test session, as undefined options are silently ignored.

To create a new Test Set from a .csv file:

curl -F "my_test_set=@testcases.csv" -X POST -k -b cookie_jar -u user:passhttps://mu-ip/api/v5/ddt/session/test/import/csv

The import action requires the following parameters:

  • my_test_set. The first parameter defines the name you want to use for the Test Set that will be created on import (fx_filename).
  • testcases.csv. The second parameter defines the filename of the .csv file that contains the testcases to import (testcases.csv).

Product : Studio Security