Modifying a Previously Recorded Rapise Test

February 6th, 2015 by inflectra

rapise test automation

You built your first test. And it works, as planned! Congratulations! Based on that test you submitted a bug and proved your worth and the value of automation! Again congrats. Now development has “fixed” the bug, time to retest. OOPS! The test fails, not due to the bug, but because the flow is wrong.

It has happened to all of us at one time or another, and is actually part of the automation process, especially with Agile projects that explicitly assume there will be significant refactoring of the user interface between sprints/iterations. Luckily, Rapise makes it easy to account for new objects and move previously learned objects.

Adjusting the Flow of your Test Script

Think about the structure of your test, specifically the layout of the <test name>.js file that is presented at the end of your recording session. Each object is called out and the action is described. Here is an example…

//########## Script Steps ##############

function Test()
{

//========== Recorded at date time PM: ======
//Press button '1'
SeS('_1').DoAction();
//Press button 'Add'
SeS('Add').DoAction();
//Press button '2'
SeS('_2').DoAction();
//Press button 'Add'
SeS('Add').DoAction();
//Press button '3'
SeS('_3').DoAction();
//Press button 'Add'
SeS('Add').DoAction();
//Press button '4'
SeS('_4').DoAction();
//Press button 'Add'
SeS('Add').DoAction();
//Press button '5'
SeS('_5').DoAction();
//Press button 'Add'
SeS('Add').DoAction();
//Press button '6'
SeS('_6').DoAction();
//Press button 'Add'
SeS('Add').DoAction();
//Press button '7'
SeS('_7').DoAction();
//Press button 'Add'
SeS('Add').DoAction();
//Press button '8'
SeS('_8').DoAction();
//Press button 'Add'
SeS('Add').DoAction();
//Press button '9'
SeS('_9').DoAction();
//Press button 'Equals'
SeS('Equals').DoAction();

}

g_load_libraries=["Generic"];

In this test you can see the direct order of objects and the actions being taken by Rapise as you interact. Imagine that you want to change this order. To do this you can merely cut and paste the line carrying the object and action to an appropriate line. We would suggest copying the descriptor line as well as that can act as a landmark for any future editing.

Lets assume your new business process requires you to interact with an object at least one additional time, this can be achieved bu copying and pasting the code for the action in question.

What if you need to create a different action on an object?

Follow along here as there are just a few steps. Select the object tree in the view on the left of Rapise and expand the grouping for your application under test. Move to the place in your test code where you need to perform the action and click there in the code so that your cursor is positioned right where you want code inserted. Next you will expand the view in the object tree, on the object which requires interaction. Under the object you will see the list of available interactions (not every action available is valid for every object), click on the icon for the interaction you desire and drag it to the position in the code where you wish it to take place, coding and syntax are created!

We would recommend placing a comment in the code beginning on its own line, starting with “//”, before each addition you make. Again this will provide you with documentation that is necessary for future manipulation and maintenance of the test.

Re-learning an Existing Object

Another type of modification you may need to make is to re-enter the learn phase. Before you do this please make sure your application is launched as Rapise will remember the application and libraries necessary for interaction, assuming the same application. Then you will either learn the object, or learn the action. Once you have learned the new elements you can click finish and return to Rapise. Once in Rapise you can either edit the code by copying/Pasting or add code through the methods we have discussed here.

All in all this makes maintenance of the test very easy. The code can be auto generated and provides you with the ability to alter the flow, add new elements, and update existing elements to reflect changes in the application.

Spira Helps You Deliver Quality Software, Faster and with Lower Risk.

Get Started with Spira for Free

And if you have any questions, please email or call us at +1 (202) 558-6885

Free Trial