It's all about the answers!

Ask a question

Reusability - Test Script and Keyword


vinitha dsouza (71635) | asked Dec 20 '18, 1:22 a.m.
Hello RQM Experts,

In RQM,  meta model defines,
Test Case -> Test scripts(1...n)-> Keywords(1.n)
as per my knowledge Test Scripts are components which i can reuse. Same applies for Keywords also.

for eg: if i a take login of web application. I can create Test script having below steps,
Test script Name: Login application
Steps: 1.Enter username, password
            2. Click on submit button.
and can add to any number of Test cases.
or other way using Keyword,

Test Script  name: Login Application
  Instead of steps use Keyword which has above mentioned steps 1 to 2.

I can apply either Test script or Keyword to attain modularity and reusablity.
If one can achieve then why Keyword functionality is brought in?

Can you give better example when we actually apply test script and keyword.

Accepted answer


permanent link
Abhishek Biswas (422) | answered Jan 30, 12:02 a.m.
You can think of Keywords being a collection of test steps which is part of a bigger test script (containing other test steps).

An example can be the "preparation steps", before the steps which test the actual requirement intended to be tested by the Test Case. Such preparation steps can be grouped in a keyword, if the same preparation steps are also valid other Test scripts.

From your example, Consider 2 Test Cases. a) Check Account Balance b) Transfer Money.

You can define a keyword to login since it will be common steps for mostly all Test Cases

Test Case Name: "Check Account Balance - ABC Bank"
              Test Script Name: "Check Account Balance"
                                          1. Open URL - ABCBank.com
                                          Keyword "Login":  
                                                1. Enter username, password
                                                2. Click on submit button.
                                          2. Click on view account Summary


Test Case Name: "Transfer Money - XYZ Bank"
              Test Script Name: "Transfer Money"
                                          1. Open URL - XYZBank.com
                                          Keyword "Login":  
                                                1. Enter username, password
                                                2. Click on submit button.
                                          2. Click to view registered payees.
                                          3. Initiate Transfer



vinitha dsouza selected this answer as the correct answer

2 other answers



permanent link
Subhajit Bhuiya (3691) | answered Dec 20 '18, 5:55 a.m.
JAZZ DEVELOPER

 It is recommended to use 1 test script per test case.

System can have 1000's of test scripts and test script it self can have many steps. Out of those steps, few group of step can be common in same as well as many test script. Create a test script with those steps and associate it with keyword. Now whenever you require those group of step in a test script, just reuse the keyword instead of writing them again. It is something like function in programming language.


Comments
vinitha dsouza commented Dec 20 '18, 8:18 a.m.
By mistake i selected this as correct answer. But i have few question,
i could even do this with Test Script. common related as one Test script and can add in other test cases. Why only Keywords?

vinitha dsouza commented Jan 03, 5:47 a.m.

Could you please answer above query


Subhajit Bhuiya commented Jan 07, 4:24 a.m.
JAZZ DEVELOPER

vinitha dsouza commented Jan 09, 8:16 a.m.
i have read this. But not able to decide what is better practise to apply.


permanent link
Bharath Rao (913) | answered Jan 11, 9:37 a.m.

Hi


Adding to the details shared by Subhajit, 

If you have a few common steps to be performed amongst other steps in multiple test script, you could use a keyword(as an alias) for the common steps.

If you have the same steps as described in a script, then simply associate it to the test cases.

Notice a subtle difference in the above use-cases.

Your answer


Register or to post your answer.