Refactor scenarios

Why refactoring?

Testing at the speed and scale of Agile requires automation and maintainable test design. And one root of the maintenance problems is copy/paste.

copypaste

That’s the reason why Hiptest enables test refactoring. Tests should be reviewed and refactored continuously, just like code. This section describes the main refactoring principles.

Promote

When you have a group of steps you want to reuse across multiple scenarios, extract them into an action word. This refactoring technique make your steps reusable and easy to maintain. Don’t repeat yourself!

1 – First select the group of steps and click the promote button.

Voila_Capture 2015-08-07_11-23-17_AM

2 – If several scenarios already use this group of steps, then select the ones you want to apply the refactoring to.

promoteselect

3 – You are done. The action word has been created with the group of steps and the scenarios you have selected now calls directly the new action word.

promoteafter

Inline

Inline is the opposite of promote. It replace an action word by its steps in every object where this action word is called.

1 – Select your action word and click inline

Voila_Capture 2015-08-07_11-24-38_AM

2 – Review all the objects (scenarios & action words) calling the action word to be inlined.

inlinepopup

3 – All the references to this action word have been replaced by the steps of the action word.

Voila_Capture 2015-08-07_11-29-29_AM

Optimize

Optimization feature enables you to find out the steps that are replicated across multiple scenarios. Once you’ve started the analysis, Hiptest suggests a couple of steps you can promote into action words. These are just suggestions and it is up to you to define if it makes sense or not.

optimization

If the answer is yes for a given Match then click Optimize and do the refactoring.

optimizationmatch

Rename

Make sure that action word naming is meaningful because it keeps test readability. And do not hesitate to rename an action word: all the references (call) to this action word are updated automatically.

Voila_Capture 2015-08-07_11-30-53_AM

Advertisements