6.4.1 Creating Automation Test Cases with TestNG and JUnit

Important_icon.pngImportant:

  • You qTest user needs to be granted with Create Test Cases permission.

»Manually Creating Automation Test Cases in qTest

»Scanning Scripting Directory and Automatically Creating Automation Test Cases

Manually Creating Automation Test Cases in qTest

Follow one of these ways to create a new Automation Test Case:

  • Select a Module and click on New Automation Test Case icon on the toolbar
  • Right click on an existing module and select New > New Automation Test Case
  • Select a Module and press hot keys Shift + A

In the Test Case's main workspace, modify the name and its properties. You may want to define its Test Steps. It is the same as creating a manual Test Case. Refer to this instruction.

You will need to define the associated test in Automation Content field with the syntax:

  • To associate a test class with a Test Case in qTest: [package_name].[class_name]. Eg: sample.testng.HelloWord
  • To associate a test method with a Test Case in qTest: [package_name].[class_name]#[method_name]. Eg: sample.testng.HelloWord#sayHello

 

Scanning Scripting Directory and Automatically Creating Automation Test Cases

Our Automation Agents feature the ability to scan and detect tests in your scripting directory; and then automatically create the associated Test Cases in qTest.

On the Agent Configuration Screen, click on Save and Scan button

 

Alternatively, select your desired agent and click on its Scan icon

The agent will start scanning your directory. After the process is done, all detected tests are listed out.

  1. You can select to view the result by test Class or Method.
  2. You can filter the result grid by package name or Class/Method name.
  3. By default, the suggested Test Case name is the same as the Class/Method name. You can click and modify it.
  4. Click on the check box on the first column of each row to select which Test Cases to be created.
  5. Click on Create button.

It will take a while to create the Test Cases in qTest. They will be located under module Automation Test Case. You can view the result's summarized information after the process is done.

button-round-warning-icon.pngHINT:

  • If a test class has some test methods, when you create a Test Case from the class, its Test Steps will also be defined and each Test Step will be associated with one test methods.
  • When you create a Test Case from a test method, it will have one Test Step associated with the test method.

Important_icon.pngImportant:

  • Field Automation Content is the unique identification of an Automation Test Case. The agents will NOT create 2 Automation Test Cases with the same value in this field.
  • For now, the agents do not support updating your Automation Test Cases.
  • When you define a Test Step for an automation Test Case, there needs to be a matching method in your test script so that the step can be executed.