How to Test using TestNG Test Result File?

Introduction

TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages, and even several external frameworks, such as application servers).

Here is how you can specify the Test Cases and Test Steps that will be created in QMetry as a part of the result files. Automation Hierarchy to be passed as automationHierarchy parameter in Automation API -


Automation HierarchyTest CaseTest Step Tag
1 (default)

<class> tag under the <test> tag will be considered as Test Case.

'name' attribute of <class> tag will used as testcase summary.

<test-method> tag under <class> tag (with attribute "is-config" not set as true) will be considered as Test Case Step.

'name' attribute of <test-method> tag will be used as Step Description.

2

<test-method> tag under <class> tag (with attribute "is-config" not set as true) will be considered as Test Case.

'name' attribute of <test-method> tag will used as testcase summary.

Test Case Step will not be created.
3

<test> tag under the <suite> tag will be considered as Testcase.

'name' attribute of <test> tag will be used as testcase summary.

<test-method> tag under <class> tag (with attribute "is-config" not set as true) will be considered as Testcase step.

'name' attribute of <test-method> tag will be used as testcase step description.


Supported Version: 1.2.5

Supported file types : XML


Automation Hierarchy 1



Automation Hierarchy 2



Automation Hierarchy 3



Reuse Manual Test Cases


No.Methods

Applicable to

Automation Hierarchy

Description
1.Summary

1,2,3

Download Sample File

  • If Test Case Summary in QMetry matches with Test Case Tag as per the Automation Hierarchy (1 to 3) described above, the same test case in QMetry will be updated.
  • If the Test Case Summary matches, but Step Description in QMetry does not match with Test Step Tag as per the Automation Hierarchy (1 to 3) described above, then new version of the same test case will be created.
2.

Keyword


@Test(groups = {"testEntityKey"})

1,2

Download Sample File

  • When a valid entity key of test case is passed through the result xml file, a new version of that test case will be created and linked to the test suite. Execution Status will also be updated.
  • When an invalid/archived test case entity is passed through the result xml file, a new test case will be created using that <class>.
  • When an entity key is of test case, whose latest version is archived but older versions are not archived, a new version of that test case will be created and linked to the test suite. Execution Status will also be updated.
  • If a manual test case is including manual steps and steps which are same as test-methods (using sharable test case), then on uploading test result using API, a new version will be created.


Reuse Automation Test Cases

Here we anticipate that the file is imported in QMetry at least once. Now when the file is imported again -

  • If Test Case Summary and Step Description match: The same test case and its version will be reused and updated in QMetry.
  • If the Test Case Summary matches, but Step Description in QMetry does not match: A new version of test case will be created.


Link Requirements to Execution


Keyword

Applicable to

Automation Hierarchy

Description

@Test(groups = {"requirementEntityKey"})


1, 2

Download Sample File

  • When a valid requirement entity key (for internal/external requirement) is passed through the result xml file, the test case which is created using <class> is linked to the requirement.
  • When an invalid/archived requirement entity key is passed through result xml file, no requirement will be linked to the test case which is created using <class>.
  • When a requirement (latest version of which is archived but older version is not archived) entity key is passed through result xml file, the test case which is created using <class> is linked to the requirement's latest unarchived version.