Create a testing project or module

Create a testing project or module using a built-in OpenText Functional Testing for Developers template or using your own custom framework.

Overview

The IDE plugin included in OpenText Functional Testing for Developers comes with built-in project or module templates. These provide a preliminary structure for your testing projects and references to the 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.

If you are using the .NET SDK 5 or later, templates are available even if you did not install any plugins. You can use these MSTest V2 templates to develop .NET testing projects with or without using an IDE.

Plugin or template installation

The IDE plugin plugin must be installed on your IDE. Typically, IDE plugins are installed during the OpenText Functional Testing for Developers installation process. However, you can also install them at any time. For details, see Change or uninstall.

If you had the .NET SDK 5 or later installed when you installed OpenText Functional Testing for Developers, the .NET templates are installed together with OpenText Functional Testing for Developers. Otherwise, you need to install the manually. See (Optional) Manually install the .NET templates.

Back to top

Project templates for Visual Studio (Windows only)

In Visual Studio, you can create NUnit or MSTest OpenText Functional Testing for Developers test projects and test items.

You can also create a project that enables you to develop Selenium tests with extended capabilities. For details, see Testing with 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.

    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

Project templates for .NET 5 and later

You can use the .NET templates in Visual Studio or without an IDE, writing code in a text editor and using dotnet tools to build and run your tests.

You can use these templates similarly to the .Net Framework ones described in Project templates for Visual Studio (Windows only).

Note the following differences: 

  • You do not need to install NUnit, this is done automatically when the project is created.

  • The templates use package references for all the HP.LFT.* and also the testing frameworks (MSTest, Nunit). As a result, they are NuGet packages that come from NuGet repositories (HP.LFT.* from the local repository installed with the templates, the testing framework packages from the global nuget.org repository).

  • The .NET MSTest templates use only MSTest V2.

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 Cucumber project, see Testing with Cucumber.

Prerequisites

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

  • If you are creating a Selenium project, review Prerequisites for Selenium projects.

  • If you are creating a Maven-based project, review Prerequisites for Maven-based projects.

  • If you are using Eclipse, Spring Tool Suite, or JBoss Developer Studio, do the following:

    To create or work with... Download and deploy or install...
    JUnit projects

    The JUnit framework.

    A TestNG project

    The TestNG plugin.

    Maven-based projects using Eclipse Kepler Standard Edition

    The M2Eclipse plugin.

  • 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, using 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 OpenText 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 OpenText Functional Testing for Developers 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: After your project is created, you 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 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 OpenText Functional Testing for Developers from your file system and not with a Maven repository and you want to use the OpenText Functional Testing for Developers 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.

Back to top

Next steps: