Using Eggplant Functional with Visual Studio

Eggplant provides two ways to perform Eggplant Functional tests from within Microsoft Visual Studio:

  • Running Eggplant Functional Scripts from Visual Studio: Use the information shown here to configure Eggplant Functional test scripts to run a basic unit test from a Visual Studio test project.
  • Using the Eggplant Integrations for Visual Studio: Use the information shown here to install and configure Eggplant Integrations for Visual Studio to run Eggplant Functional test scripts as generic tests from a Visual Studio test project. The Eggplant Integrations for Visual Studio is only available for Visual Studio 2013 Premium or Ultimate edition.

Running Eggplant Functional Scripts from Visual Studio

The Eggplant Functional application provides two available integration approaches, command line and XML-RPC using Eggdrive, which you can use to run Eggplant Functional scripts from Visual Studio and other test execution tools. Use the information shown here to configure a Visual Studio test project to run Eggplant Functional scripts using Eggplant's command line or XML-RPC interfaces.

Adding Tests to Visual Studio

You must create a test project in Visual Studio to run Eggplant Functional tests:

  1. From the main menu, select File > New > Project.

    Creating a New Project

  2. In the left sidebar of the New Project dialog box, select Visual C# > Test.
  3. In the main window, choose Unit Test Project.
  4. Make the selection shown below to create a new Basic Unit Test item in Visual Studio:

    Creating a basic unit test in Visual Studio

  5. After the project is created, delete the generated UnitTest1.cs file.

Read the following information to help you decide which integration approach is right for you:

  • Integration Option 1: Command Line

    • It uses standard command line syntax.
    • It is available for all Eggplant Functional license types.
    • It automatically starts and stops the Eggplant process as at the beginning and end of the script execution.
    • It assumes that you installed Eggplant Functional on the same machine as Visual Studio.
  • Integration Option 2: XML RPC using Eggdrive

    • It leverages XML-RPC libraries to interface between Eggplant Functional and your test execution harness/tool. XML-RPC libraries are available for most popular scripting languages, including C#, Ruby, Java, Python, and more.
    • It is available with Team Eggplant Functional licenses or Eggdrive-enabled node-locked licenses.
    • It runs as a web service on your internal network and can be leveraged by a test harness that runs on a machine that is separate from Eggplant Functional.
    • The Eggplant Functional application must be running in Eggdrive mode for the test harness and tool to communicate with it.

Using the Eggplant Integrations for Visual Studio

Only use the Eggplant Integrations for Visual Studio if you plan to integrate Eggplant Functional with Visual Studio version 2013.

Use Eggplant Integrations for Visual Studio, an extension to Visual Studio, to run Eggplant Functional test scripts as generic tests from a Visual Studio 2013 test project. Teams that use the Microsoft application lifecycle management (ALM) systems of Team Foundation Server (TFS) or Visual Studio Online can install this extension, then execute Eggplant Functional tests from Microsoft Test Manager or from a Visual Studio build.

Integrate the Visual Studio generic tests that call Eggplant Functional scripts into the standard Microsoft ALM workflows in the same way as any other Microsoft ALM automation test. For information about running Visual Studio tests, see the Microsoft documentation:

Requirements for Eggplant Integrations for Visual Studio

Make sure your system meets the minimum requirements to run Eggplant Integrations for Visual Studio:

Note: Visual Studio Professional, Express Editions, Community Editions, or Microsoft Test Professional do not support creating generic tests.

インストール

Download Eggplant Integrations for Visual Studio from the Eggplant downloads page. As a user with local administrator permissions, execute Eggplant IntegrationsVS_setupX.exe (where X is a version number), then follow the steps in the Setup wizard. On the final screen, make sure you allow the wizard to install the Visual Studio Packages on completion.

By default, Eggplant Integrations for Visual Studio is installed to C:\Program Files (x86)\Eggplant Visual Studio Integration. However, you can change this location in the Setup wizard. The Visual Studio package installer is copied to the same folder in which you install the application. Manage packages from the main menu in Visual Studio by going to Tools > Extensions and Updates. The Extensions and Updates dialog box lets you disable or uninstall packages.

Adding Tests to Visual Studio

You need to create a test project in Visual Studio to run tests. From the main menu, select File > New > Project. In the left sidebar of the New Project dialog box, select Visual C# > Test, and in the main window, choose Unit Test Project. You can also select Visual Basic, but not C++. When the project is created, you can delete the generated UnitTest1.cs file.

Note: The project must be a test project. Otherwise, you cannot execute the tests even though you can add them to a project.

Creating a new test project in Visual Studio to use for eggIntegration with eggPlant Functional

Creating a new test project in Visual Studio

After you open the project, select Tools > Eggplant Functional Tests from the main menu. The following dialog box is displayed:

eggPlant Functional Generic Test Creation dialog box in eggIntegration for Visual Studio

If you select Run scripts using Eggplant Drive mode and a Host that is a remote machine, then the suite path browse button and Add scripts button are disabled. With this setup, you must manually enter the scripts and suite path on the remote machine. Selecting the option to run Eggplant Functional scripts on the local machine uses command-line execution of Eggplant Functional.

To add scripts to a test, click the Add scripts button. You can also click in the bottom blank row of the Script list, then type a new script name. To edit an existing script, double-click a row in the Script list. You need to enter only the name of the script in the suite.

The dialog box saves the selected settings for the user between sessions. After you select the suite and scripts and click OK, a generic test is created in the project for each script:

A generic test in Visual Studio for eggPlant Functional scripts

To open the Test Explorer window, select Test > Windows > Test Explorer from the main menu. The Test Explorer window opens in the left sidebar of Visual Studio.

Open or double click a generic test in the Solution Explorer in the right sidebar to view or edit the command-line arguments for RunEPFScriptVS.exe, which is the process that executes the script and collects the results.

If you have a host:port specified, the execution uses Eggdrive. Otherwise, it runs Eggplant Functional through the command line on the local machine.

When you’re running through eggDrive, RunEPFScriptVS.exe uses XML-RPC to connect to Eggplant Functional. It selects the suite and calls RunWithNewResults scriptName.

If a host argument is not given, the script executes by calling RunScript.bat with the command line arguments:

runscript.bat "fullScriptPath" -GlobalResultsFolder Results [optional other parameters]

Running Tests

To begin execution of your test, right-click a test in the Test Explorer window or use one of the Run menu items.

The Eggplant Functional script log output is translated into the Visual Studio format and copied to the Visual Studio test location. Click the Output link at the bottom of the Test Explorer window to see the results, errors, and any screenshots. The results files created by Eggplant Functional are not deleted, so you can still view script results in the Eggplant Functional UI as well.

To run tests from Microsoft Test Manager, you must set up a test controller and test agents as described in the Microsoft documentation, Setting Up Test Machines to Run Tests.

 

This topic was last updated on 2月 01, 2019, at 11:13:23 午前.

Eggplant icon Eggplant.io | Documentation Home | User Forums | Support | Copyright © 2019 Eggplant