Create a LeanFT testing project or module

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

Overview

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

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

Note: You can install the LeanFT plugin on one or more Eclipse or Spring Tool Suite 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

LeanFT project templates for Visual Studio (Windows only)

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

You can also create a project that enables you to develop Selenium tests with extended capabilities. For details, see LeanFT 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 Product Availability Matrix. To download NUnit , see the NUnit download site.

  2. Create a new project. Select Visual C# > Test project, and then either the LeanFT 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 LeanFT.

Back to top

LeanFT project templates for Eclipse, Spring Tool Suite, or IntelliJ IDEA

In Eclipse, Spring Tool Suite, and IntelliJ IDEA, 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 LeanFT Cucumber project, see LeanFT 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
    • If you are working with IntelliJ, you need IntelliJ IDEA 2017.2.5 or higher

    • If you are working with Eclipse, you need Eclipse Oxygen 4.7.1a or higher

Create a Java test project

  1. In your IDE, create a new project.

    In the New Project wizard:

    1. Create a LeanFTTesting 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.

      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 LeanFT or by the IDE.

    • In Eclipse, the JUnit jars are automatically downloaded when the project is created.
    • In IntelliJ IDEA:

      • 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 and Spring Tool Suite users: Add test cases using the New LeanFT Test Case wizard (New > Other > LeanFT > LeanFT 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 LeanFT tests.

Back to top

LeanFT module template for Android Studio

For Android Studio, you can create a LeanFT module.

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

To create a LeanFT 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 LeanFT module.
  3. In Android Studio, click File > New > New LeanFT Module.
  4. On the Create New LeanFT Module dialog box, enter the Module name and the Java package name, and then click Finish.

    A LeanFT 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 LeanFT from your file system and not with a Maven repository and you want to use the LeanFT JavaDoc, you need to add it manually from the Library Properties of the LeanFT 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 LeanFT SDK library.

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

Back to top

Next steps: