Create a UFT Developer testing project or module

Create a testing project or module using a built-in UFT Developer template or using your own custom framework.

Overview

The UFT Developer plugin in your IDE comes with built-in UFT Developer project or module templates. These provide a preliminary structure for your testing projects and references to the UFT Developer files you need. They also enable you to use the functionality provided with the framework for developing test code and running your tests.

Project templates are available for JUnit, TestNG, NUnit, and MSTest.

The UFT Developer plugin must be installed on your IDE. Typically, IDE plugins are installed during the UFT Developer installation process. However, you can also install them at any time. For details, see Maintaining and uninstalling UFT Developer.

Note: You can install the UFT Developer plugin on one or more Eclipse, Spring Tool Suite, or JBoss Developer Studio packages deployed on the same machine. To do this, see our blog post: How to install the LeanFT Eclipse plugin for multiple Eclipse packages deployed on the same machine.

Back to top

UFT Developer project templates for Visual Studio (Windows only)

In Visual Studio, you can create NUnit or MSTest UFT Developer test projects and test items.

You can also create a project that enables you to develop Selenium tests with extended capabilities. For details, see UFT Developer for Selenium.

Create an NUnit/MSTest project

  1. If you are creating an NUnit project, make sure that you have a supported version of the NUnit framework installed. For details on supported NUnit versions, see the Support Matrix. To download NUnit , see the NUnit download site.

    Note: In NUnit 3, the NUnit Runner and the NUnit framework are installed separately. Make sure to install the NUnit framework, preferably through the NuGet package manager.

  2. Create a new project. Select Visual C# > Test project, and then either the UFT Developer NUnit or MSTest project templates.

  3. To add a test item in the project, in the Solution Explorer, right-click the project and select Add UFT Developer.

Back to top

UFT Developer project templates for IntelliJ IDEA and Eclipse

In IntelliJ IDEA and Eclipse (including also Spring Tool Suite and JBoss Developer Studio), you can create the following projects:

JUnit and TestNG

These projects can be:

  • Maven-based: Include resources for running your tests with Maven.
  • Selenium-based: Include resources for integrating with Selenium.

Cucumber

The Cucumber template is based on the Java testing framework (JUnit) and is Maven-based. For details on creating a UFT Developer Cucumber project, see UFT Developer with Cucumber.

Prerequisites

Before you create a Java project, review the following prerequisites:

  • If you plan create a project that is based on the JUnit 5 template, make sure that you have the following installed:

    Java 8

     
    IntelliJ IDEA 2017.2.5 or higher If you are working with IntelliJ.
    Eclipse Oxygen 4.7.1a or higher If you are working with Eclipse.

Create a Java test project

  1. In your IDE, create a new project.

    In the New Project wizard:

    1. Create a UFT DeveloperTesting project.

      IntelliJ IDEA users: Ensure that the correct Project SDK is selected.

    2. Follow the wizard, selecting the relevant options for your project:

      All projects

      Provide the project name and location.

      Eclipse users, UFT Developer 15.0.2 and later, Java 9 or later: When creating the project, clear the option Create module-info.java file. Otherwise, after the project is created, manually move the Micro Focus external .jar files in the Java Build Path, from Classpath to Modulepath. For details, see Move external .jar files from Classpath to Modulepath in the Java Build Path.

      Selenium
      1. Select Selenium.
      2. Non-Maven based project: Provide the location of your Selenium JAR files.
      Non-Maven-based project

      Provide the package name (Eclipse)/base package (IntelliJ IDEA), for example: com.microfocus.lft.

      Maven-based project

      Provide the Group ID and Artifact ID, and the Maven version.

      IntelliJ IDEA users: If you are creating a Maven-based project, a message appears prompting you to Add as Maven project. Click the link to create the Maven-based project.

      JUnit Select the JUnit version.
  2. If you are using a JUnit 5 framework, note that the JUnit 5 libraries are not distributed automatically by UFT Developer or by the IDE.

    • In Eclipse, the JUnit jars are automatically downloaded when the project is created.
    • In IntelliJ IDEA, for Non Maven-based projects: Once your project created, you will need to reconcile this issue by adding them manually:

      Expand the imports section, click the IDE suggestion, and then select Add JUnit5.0 to classpath.

      On the Download Library from Maven Repository, dialog box, click OK.

  3. Eclipse, Spring Tool Suite, and JBoss Developer Studio users: Add test cases using the New UFT Developer Test Case wizard (New > Other > UFT Developer > UFT Developer Test Case), selecting the relevant options for your test case.

  4. Maven-based project: The project is created with a pom.xml file. Open this file in a text editor and configure your organization's Maven repository details:

    <repository>
    	<id>MyMVNrepo_ID</id>
    	<name>MyMVNrepo_name</name>
    	<url>http://MyMVNrepo_URL</url>
    </repository>

    Note: To run the Maven-based test using Maven, there are some additional configurations you need to apply to the pom.xml file. For details, see Run UFT Developer tests.

Back to top

UFT Developer module template for Android Studio

For Android Studio, you can create a UFT Developer module.

The UFT Developer module template is based on JUnit, but includes enhancements to help you create mobile tests easily.

To create a UFT Developer module

  1. If you are working with a Maven repository, follow the instructions in Prerequisites for Maven-based projects.
  2. Open the project to which you want to add the UFT Developer module.
  3. In Android Studio, click File > New > New UFT Developer Module.
  4. On the Create New UFT Developer Module dialog box, enter the Module name and the Java package name, and then click Finish.

    A UFT Developer module is created with all the required resources.

  5. If you are working with a Maven repository, open the module's build.gradle file, and follow the instructions in the file.
  6. If you are working with UFT Developer from your file system and not with a Maven repository and you want to use the UFT Developer JavaDoc, you need to add it manually from the Library Properties of the UFT Developer SDK jar.

Back to top

JavaScript template for supported IDEs

You can write JavaScript tests using any of the supported IDEs.

For a starting template for JavaScript tests, see Setting up and working with the JavaScript SDK.

Back to top

Custom template

If you are using a custom framework:

  1. Ensure that your project references a number of items from the UFT Developer SDK library.

  2. Set up your project as described in Use your own frameworks with UFT Developer.

Back to top

Next steps: