# Generate Template from Test Case
This guide will explain how you may convert your existing test case into a template.
Step 1: [Optional] First identify the hardcoded values in the test case which you would like to make template variables. e.g. For the Login API
test case, hardcoded values can be email
and password
. It depends on your particular test case.
Suppose, we have the following Request Body for our sample test case.
Then instead of hardcoded values, we can use template variables like this:
And we can define the hardcoded values in the Template Data
section like this:
You can execute your test case to see that if it is still working or not. In the same way, you may even extract the hard-coded values from the Response validation tab as well and make them template variables.
Step 2: Extract template from the test case
Now, just go to the Details Tab
of the test case and click on the button Extract Template
to extract the template from this test case.
Once you click on this button, you can see that the template has been extracted from the test case, and now the test case refers to the generated template.