# Export and import Virtuoso goals

You can export journeys on the goals (e.g., for backup purposes, or to move them to other environments), and import them to an existing goal.

# Export goal version

You can export a goal using the Import / Export option from any goal's context menu. From the project dashboard you can export the latest goal version with the following steps:

  1. Click on the goal's context menu and select Export/Import option;
  2. Click on the Export tab;

Import/Export goal - export tab

  1. Click on the Export button.

Shortly after, the browser will download a JSON file containing the exported goal's information.

Exporting a specific goal version

You can use the goal's context menu on the Goal view to export the goal version being viewed: choose the goal version to export using the date picker on the top right of the page, and follow the steps above but from the Goal view on the specific version to export.

# Creating a goal from an export

After exporting a goal (see Export goal version), you can use the export file to create a new goal in another project. From the other project dashboard:

  1. Open the context menu at the start of the goals section;
  2. Click on Import goal (if the project has no goals yet, the action Import goal will be shown on the screen instead);
  3. Drag and drop a previously exported JSON goal file or click on browse .json file;

Import/Export goal - Import Tab

  1. Click on the Import button;

Importing over an existing goal

You can also import as the latest version of any existing goal. From the Goal view, open on the goal's context menu, click on Import goal, and follow the steps above.

This will create a new latest version with the information on the exported file. If you need to revert the operation you choose the previous version with Browse version history and use the rollback option in the goal's context menu.

# Exporting Virtuoso tests in Selenium format

You can export Virtuoso journeys to run in your local environment, maintain separately, or to use for integrating with specialized tools.

We currently support Selenium as an export format, with other export formats available on demand (please contact our support if this becomes a need).

# Export journeys in Selenium

Virtuoso can export your goals' journeys as Selenium JUnit tests. For this, Virtuoso creates a single Java class file per goal, where each journey is a separate test method.

Open the goal's context menu clicking on the icon and now click on the option Export journeys in Selenium option. The browser will prompt to download the generated Java class file similar to the following example:

// import statements

public class TestClassName_BasedOn_Your_GoalName_And_TimeOfExport {
  private static WebDriver driver;

  public void setup() {...}

  public void cleanup (){...}

  private WebElement getElement(boolean failIfNotPresent, By... selectors) {...}

  /*Journey name*/
  public void test_315785() throws Throwable {
    /*Checkpoint: Navigate to My Project's Dashboard*/
        By.cssSelector(":nth-child(1) > .login__input"),
        By.linkText("user email")
      ).sendKeys("[email protected]");
        By.cssSelector(":nth-child(2) > :nth-child(2) > .login__input"),
        By.cssSelector(":nth-child(2) > .button"),

This test consists of a few parts:

  1. Setup/tear down methods - used to initialize the Selenium web browser and clean up after test execution;
  2. getElement method - a helper method to aid in element selection using Virtuoso's selectors;
  3. Tests for a goal - each test will be written in a Selenium-executable format.

Selenium tests will export the following from Virtuoso:

  • Virtuoso test steps as Selenium instructions;
    • Note: Commands that cannot be exported will generate the comment command not exportable at the appropriate line
  • All current element selectors (excluding intelligent selectors);
  • Journey and checkpoint names as comments.

It is important to note that the tests exported from Export Journeys in Selenium do not contain the full functionality of Virtuoso. For example, some of the following will not be possible:

  • Intelligent element selection using hints;

  • Intelligent element healing;

  • Screenshots are not captured by default (although you can add your own screenshot-capturing logic to the Java tests);

  • Popup auto-dismiss;

  • Data driven testing;

  • any other intelligent behaviour from Virtuoso bots.

# Running Selenium tests

There are some prerequisites to running the Selenium tests exported from Virtuoso:

  • JDK 8+;
  • Google Chrome browser;
  • Chrome driver: http://chromedriver.chromium.org/downloads

Once the prerequisites are fulfilled, the environment needs to be initialized. We provide a template project in which you can simply drop the selenium tests and run them.

  1. Download the prepared Selenium runner template and unzip to a desired directory.
  2. Download the exported selenium tests as described above into the src/test/java directory within the location you unzipped the template project (where Test_My_Goal.java exists).
  3. Execute the test by running gradlew test in the command line, from the project's root directory.
    • The latest version of Chrome web driver should be automatically downloaded.

This will load Google Chrome and execute the tests on your local environment in a headless environment.

Last Updated: 1/20/2021, 11:28:39 AM