Test using JUnit


Introduction

JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.

Based on your testing practices you can choose to create combination Test suite, Test Cases and Test Steps that will be created in QMetry after importing the automation result file. You need to provide a value in automationHierarchy parameter in Automation API - while importing the test results. Based on the table below the Test artifacts will be created in QMetry.


Automation Hierarchy ValuesFollowing QMetry assets will be created and linked

Test Suite

Test CaseTest Step
1

Testsuite, Test Case, Test Step

Testsuite will be created based on testsuiteName parameter in Automation API or Auto generated if not mentioned.

<testsuite> tag  : Parsed from the result file.


Junit File Type 1: Wherein testsuite "name" matches the test case "classname".

  • Test Suite will have test cases as per the <testsuite> tag with steps as per the <testcase> tags.

  • Only one version of test cases will be created with multiple test steps.

<testcase> tag under the <testsuite> tag  : Parsed from the result file.

classname.name() will be the Test Step Description.

Execution Status in QMetry will be determined based on the result mentioned in the result file as shown below.

Tag inside <testcase>Execution Status in QMetry
<failure>Failed
no tagsPassed
<skipped>Not  Run

<testsuite> tag : Parsed from the result file.

Junit File Type 2: Wherein testsuite "name" does not match the test case "classname".

  • Test Suite will have multiple versions of the same test case linked as per the <testsuite> tag.

  • The number of versions will match the occurrences of the <testcase> tag.

  • For each test case version, there will be one test step.


2

Testsuite, Test Case

Testsuite will be created based on testsuiteName parameter in Automation API or Auto generated if not mentioned.

<testcase> tag under the <testsuite> tag : Parsed from the result file.

classname.name() will be the Test Case summary.

NA
3

Testsuite, Test Case

<testsuite> tag 

<testcase> tag under the <testsuite> tag : Parsed from the result file.

classname.name() will be the Test Case summary.

NA


Supported Version: 1.2.5

Supported file types : XML

Sample Test Result File


Automation Hierarchy 1

JUnit File Type 1: Click here to download a sample file.



JUnit File Type 2: Click here to download a sample file.



Automation Hierarchy 2

Click here to download a sample file.



Automation Hierarchy 3

Click here to download a sample file.



→ “Skip” status in the automation result file will be applied as "Not Applicable" instead of "Not Run" for automation test executions upload into QMetry.