Refactor – Extract Method


Extract Snippets of script into Modules

MarathonITE provides refactoring to extract some of the script code into a separate function. By continuously refactoring, you can improve modularity and reusability of your test scripts.

Improve reusability and modularity

Marathonite Extract Module Refactoring

You can use MarathonITE’s “extract module refactoring” to select parts of a test script and convert it into a module. By creating module methods – which appear as function calls in the original script – you can improve the readability and maintainability of the scripts.

You can also reuse the module methods while recording test scripts. You can use the Marathon Control Centre to insert a script into the current recording. MarathonITE performs all the actions within the module, before inserting the function call into the script.

Automate recurrent tasks

You can also use extract module refactoring to automate recurrent tasks. For example, you have a form that requires a lot of fields to be filled up. In testing, usually for each test we need to modify a couple of fields, leaving the rest with default values. By recording a script to fill up the form with default values and extracting it into a module method, you have a handy insertable method with all form fields already filled with default values. When you insert, you just need to modify only the fields that are required for the test. Thus saving time.