Test Using TestNG
TestNG Framework
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).
Writing a test is typically a three-step process:
Write the business logic of your test and insert TestNG annotations in your code.
Add the information about your test (for example, the class name, the groups you wish to run, and so on) in a testng.xml file or in build.xml.
Run TestNG.
Refer to the following table to know how to specify the Test Cases and Test Steps, which will be created in QMetry as a part of the result files.
Automation Hierarchy | Test Cycle | Test Case | Test Step Tag |
|---|---|---|---|
1 (default) | NA | Test Name is created as Test Case.
| Test Method Name is created as Test Step.
|
2 | Test Name is created as Test Cycle. If there are multiple tests in the result file then multiple test cycles will be created based on the test name.
The parameter Test Cycle to Reuse will be ignored in the Automation. | Test Method Name is created as Test Case.
| NA |
3 | Suite Name is created as Test Cycle. If there are multiple suites in the result file then multiple test cycles will be created based on the suite name.
If the value is provided for the Test Cycle to Reuse parameter, then the suite name in the files will be ignored. All the test case results for all suites and files will be uploaded in a single cycle similar to Hierarchy 1 (default). | Test Method Name is created as Test Cases.
| NA |
Note: If the Test Name or Test Suite Name length is more than 255 characters, the name will be truncated.
Supported Version: 1.2.5
Supported file types : XML
Sample Test Result File
Click TestNG with multiple tests.xml to download the Sample Test Result File.
Automation Hierarchy 1

Test Case Key: The Test Case Key to be reused is mentioned in the Group. Methods, in which the Test Case Key will be reused, are placed inside the Group.
Story Key: TheStory Key is mentioned in the Group. Methods, which are to be linked to the story, are placed inside the Group.
Automation Hierarchy 2

Automation Hierarchy 3

Reuse Manual Test Cases
Keyword | Download Sample File | Description |
testcasekey | While importing test result file, if you want to reuse test cases, then it is possible. The mapping of test steps depends on the matchTestSteps parameter. If the matchTestSteps parameter is set as “True” (Default): Create/Reuse a test case with a summary and test steps that exactly match the automated test case uploaded through the result file. The execution results and other execution details of the test case and steps will be imported from the automation result file.
If the matchTestSteps parameter is set as “False”:
|
Link Stories
Keyword | Download Sample File | Description |
storykey | The specified stories will be linked to the created/reused test case.
|