1. Configure a Project

Applies to TestLeft 15.40, last modified on March 17, 2022
  1. Create a new Maven project:

    New Project

    Click the image to enlarge it.

    Note: If you use Java 9, you may need to explicitly configure your project to be compiled to version 1.6 or later:

    Java


    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.7.0</version>
          <configuration>
            <source>1.6</source>
            <target>1.6</target>
          </configuration>
        </plugin>
      </plugins>
    </build>

    Otherwise, the project will be compiled to version 1.5 that Java 9 does not support, and an error may occur.

  2. Put the following dependencies to the pom.xml file:

    • To add JBehave libraries to your project, use the following dependency:

      pom.xml

      <dependencies>
      ...
          <dependency>
              <groupId>org.jbehave</groupId>
              <artifactId>jbehave-core</artifactId>
              <version>4.1.3</version>
              <scope>test</scope>
          </dependency>
      ...
      </dependencies>

    • Add a reference to the TestLeft library. It is located in the <TestLeft>\API\Java folder.

      pom.xml

      <dependencies>
      ...
          <dependency>
              <groupId>com.smartbear.testleft</groupId>
              <artifactId>testleft</artifactId>
              <version>2.42</version>
              <scope>system</scope>
              <systemPath><TestLeft 2>/API/Java/testleft-2.42.jar</systemPath>
          </dependency>
      ...
      </dependencies>

    • Also, TestLeft requires the following dependencies:

      pom.xml

      <dependencies>
      ...
          <dependency>
              <groupId>com.google.code.gson</groupId>
              <artifactId>gson</artifactId>
              <version>2.8.2</version>
          </dependency>
          <dependency>
              <groupId>org.apache.httpcomponents</groupId>
              <artifactId>httpclient</artifactId>
              <version>4.5.3</version>
          </dependency>
          <dependency>
              <groupId>org.apache.commons</groupId>
              <artifactId>commons-compress</artifactId>
              <version>1.15</version>
          </dependency>
      ...
      </dependencies>

Note: After you specify new dependencies, the Maven project may need to download new libraries. To do this in IntelliJ IDEA, click Import Changes, or click Enable Auto-Import to allow the IDE to do that automatically:
Import Changes

Click the image to enlarge it.

Prev     Next

See Also

Behavior-Driven Development
About Behavior-Driven Development

Highlight search results