SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

How and where to use "Rollup" command in selenium IDE

"Rollup" command is used as a bunch of commands in selenium IDE. "Rollup" command is very useful feature in selenium IDE to reduce size of test case. Let me tell you one example for better understanding. Suppose we are testing any mail login software application features considering bellow given scenarios.

Software Test Scenario1 :
  • Login in to email account.
  • Click on "Inbox" folder.
  • Logout
Software Test Scenario2 :
  • Login in to email account.
  • Click on "Draft" folder.
  • Logout
For above scenarios, my test case in selenium IDE will be as bellow.


New Test
CommandTargetValue
openReplace with my mail login URL
sendKeysReplace with element id of User ID fieldmyuserid
sendKeysReplace with element id of password fieldmypassword
clickAndWaitReplace with element id of login button
clickReplace with element id of inbox folder
clickAndWaitReplace with element id of signout button
openReplace with my mail login URL
sendKeysReplace with element id of User ID fieldmyuserid
sendKeysReplace with element id of password fieldmypassword
clickAndWaitReplace with element id of login button
clickReplace with element id of Draft folder
clickAndWaitReplace with element id of signout button

Now Using Rollup Command, above test case will be as bellow.


New Test
CommandTargetValue
rolluplogincommands
clickReplace with element id of inbox folder
clickAndWaitReplace with element id of signout button
rolluplogincommands
clickReplace with element id of Draft folder

clickAndWaitReplace with element id of signout button

Now you will think how this will works. Before using "Rollup" command, you need to create userextension-rollup.js file and need to attach it with selenium IDE. 

I created sample userextension-rollup.js. Click here to download it. Attach that file as a user extension with selenium IDE. Click here to know how to attach user extension file with selenium IDE. (Replace all targets with real id or name or xpath of targeted element before attaching file). After attaching file, copy paste above test case in your selenium IDE.

In this way, you can use 'Rollup' command with selenium IDE when you need to use bunch of commands frequently in same test case or different test cases.

10 comments:

  1. That's nice. Thank you!

    I'm wondering if I have to write an userextension for every rollup I want to use.
    It is just copy&paste all the commands, targets and values from the Source tab in the IDE. What a stupid work...
    It would be fantastic if I could just mark the commands for the rollup in the IDE an create the userextension by mouseclick.
    Is there any posibility to do so?

    ReplyDelete
  2. can we use roll up rules to include aother test suite within a test suite?

    ReplyDelete
    Replies
    1. I am not sure if any way.. Please update me too if find anywhere.

      Delete
  3. can we use roll up rules with other user-extension files like sideflow?

    ReplyDelete
  4. Yes, user-extensions.js is just that... user extensions. You can have as much JavaScript as you would like in that file. So just edit the file and add all the code you want to use in a single file including your SideFlow and your RollupManager configuration.

    Also, since the user-extensions.js is the last one loaded on the page... you have full access to Selenium's JavaScript objects and API.

    I don't see in Selenium IDE how to use the GUI to create the rollups... However, you're more than welcome to program it in JavaScript and contribute it back to the Selenium IDE project at:
    https://github.com/SeleniumHQ/selenium

    More precisely the IDE code lives at:
    https://github.com/SeleniumHQ/selenium/tree/master/ide

    Selenium IDE itself is a Firefox extension. If you don't know how to develop one see:
    https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/Firefox_addons_developer_guide/Firefox_extensions_and_XUL_applications

    ReplyDelete
  5. Any Replacement button for Click? if i want to click on login button.. can i use any other button>??

    ReplyDelete
  6. Hi, can you help me on using mutliple rollup.js in selenium IDE. I have tried uploading 2 rollup.js but only one is identified by selenium IDE command rollup.

    ReplyDelete
  7. Hi, can you help me on using mutliple rollup.js in selenium IDE. I have tried uploading 2 rollup.js but only one is identified by selenium IDE command rollup.

    ReplyDelete
    Replies
    1. Instead of uploading multiple files, you should include the rollup rules in one javascript file like this:

      var manager = new RollupManager();

      manager.addRollupRule({
      name: 'name_rule1',
      description: 'description of rule1',
      args: [
      // include arguments here
      ],
      commandMatchers: [],
      getExpandedCommands: function(args) {
      var commands = [];
      // include commands here

      return commands;
      });

      manager.addRollupRule({
      name: 'name_rule2',
      description: 'description of rule2',
      args: [
      // include arguments here
      ],
      commandMatchers: [],
      getExpandedCommands: function(args) {
      var commands = [];
      // include commands here

      return commands;
      });

      Delete