Back to QMetry All Products Help Page
Create and Update Test Cases Using Feature File
QTM4J allows users to use a BDD feature file to create new test cases directly from the feature file and update details of the existing test case as per the feature file.
You can access the feature from the following modules and pages:
(A) Create a Test Case from Jira Story
Testers can create test cases directly from the feature file or the BDD code (written in Gherkin syntax) entered in the BDD section of the Jira Story page. The Given-When-Then structure of BDD makes it easier to translate user stories and acceptance criteria into testable scenarios. The creation of test cases from the feature file and linking with the Story can significantly improve test coverage and traceability between requirements, BDD scenarios, and test executions.
The test cases get linked to the Story from where they are created. If valid Test Case Keys are found in the Feature file, the test cases are also linked to the Story.
→ Pre-requisite: To display the BDD section on the Story issue page in Jira, the BDD Panel option should be enabled in the Project Settings. Refer to BDD in QMetry Test Management for Jira (QTM4J) for more details on configuring BDD and enabling BDD panel.
Steps
1. Open the Story details page.
2. Go to the BDD section.
3. To create a test case(s) from the entered Gherkin code, click on the Test Cases button placed above the editor.
The Create Test Case screen opens with all the system and custom fields displayed on it.
4. Import Settings: Define the test case fields and set a preference for the import options for the Test Case Key and Labels.
Select Test Case Fields: The Summary, Description, and Steps will be imported from the feature file. Select values for other system fields and custom fields on the screen.
Note: The selected fields will be applied to all test cases created from the feature file. The selection will be saved for future imports.
Import Options: Select the appropriate behavior for the given options.
If a Test Case Key is found for a scenario: If the Test Case Key mentioned in the result file matches with the Test Case Key in QTM4J, you can opt to either of the following.
Update current version: The existing version of the test case will be updated for the result file details.
Create a new version: A new version of the test case will be created with the result file details.
Tags will be imported as labels. If labels are not found.: If the Tags mentioned in the result file do not exist in QTM4J, you can opt to either of the following.
Create: If the Tags mentioned in the result file do not exist in QTM4J, they are imported as labels in the Configuration section and applied to the test case Labels field.
Ignore: If the Tags mentioned in the result file do not exist in QTM4J, they are not imported into QTM4J and just ignored.
5. Click on the Create button.
View Status
Click on the icon for Test Case Import/Create Background Jobs.
The screen displays operations related to the creation or import of test cases through the feature file.
You can see the record is added for the recent feature file import.
The details include Batch Id, Source, File Name, Status, Import Date, and Imported By. Expand the record to view the details of Scenarios imported during the operation, Test Case Keys to which the scenarios were mapped, test case version, and Status.
The test cases were created using the Feature file used in the Story. You can view the test cases on the Test Case/Acceptance Criteria tab.
In the Test Case module in QTM4J, the Test Case Keys mentioned in the Feature file are reused and the relevant test cases are updated either with the existing version or with the creation of a new version as per the set configuration.
(B) Create or Update a Test Case from Test Case Module
You can use a feature file to create a new test case directly from the feature file and update the details of the existing test case as per the feature file.
Business Rules
The Summary and Steps in the feature file will override the existing content of the test case while creating or updating the test case from the Scenario option.
Steps will be created as Steps and Data Table will be Test Data.
Elements not supported: Rules, Tags, Story Key, and Test Case Key are not supported.
Only Scenario is supported.
If a Story Key or Test Case Key is mentioned in the file, it will be created as Labels in the test case.
When the feature file is imported from the test case detail page, the Examples in feature file will not get created as Parameters in the Steps.
Create a New Test Case
You can use the feature file to create a new test case from the Test Case module.
1. Go to the Test Case module.
2. Click on the New button, and then click the Scenario button.
3. Enter the BDD code from which you want to create a test case(s) and click on the Import button.
Verify the Import
The Summary and Steps details are entered in the test case as per the Feature file.
→ Test Case Detail tab
On the Detail tab, the Summary field value is taken from the Feature file. You can enter values in other fields.
→ Steps tab
The Given-When-Then in the Feature file gets added as steps in the Steps tab.
Update an Existing Test Case
You can use the feature file to update an existing test case. It will override the existing summary and steps with the new details.
1. Open the test case detail page and click on the Scenario button.
The Import from Scenario screen opens with the Gherkin editor.
2. Enter the BDD code or feature file text in the editor.
3. Click on either of the following buttons:
Update Current Test Case Version: The existing version of the test case will be updated for the mentioned scenario.
Create New Version: A new test case version will be created for the entered scenario.
4. Copy linked stories of the previous version to the newer version: If this option is selected, the new version of the test case will be linked to stories from the previous version. The previous version of the test case will remain linked to those stories.
(C) Import Feature File from Test Case Module
Refer to Import and Create Test Cases Using BDD Feature File | Import Feature File for details.
Back to QMetry All Products Help Page