As you begin to build bigger and more complex scripts you will notice that you use similar sequences of Script Items over and over again. You may find, for example, that very many of your tests need to execute a common sequence of actions to "Login" before running tests. You would find that you had those same actions recorded all throughout your tests, not only would you get sick of recording the same sequence over and over again, but your scripts would get bloated and overcomplicated by all the unnecessary items. Even worse, if your web site changed you might have to go through all your tests to update every place where you had recorded these common items.
Badboy provides a solution to these problems in the form of Custom Items. Custom Items work the same way as the other items in your Toolbox do, except that instead of Badboy providing them, you create them yourself. A Custom Item can contain many regular script items grouped together. Custom Items can even contain other Custom Items, letting you build your tests from a hierarchy of reused components.
Creating a Custom Toolbox Item
Creating a Custom Toolbox Item is very easy - simply drag an item from your script into your Toolbox. Badboy will prompt you for a name for your new Custom Item.
Once you have created a Custom Toolbox Item it will appear in your Toolbox with the name that you gave it.
Using Custom Toolbox Items
Once you have created a Custom Toolbox Item, using it is as easy as using any other Toolbox Item - just drag it from your Toolbox into your script at the location you want it to go. When you drop the item into your script, Badboy will prompt you for a name for it. You can just use the default name if you like, or you can give it a new name of your own. The name you give it is just for display purposes and won't affect it's operation.
Badboy also lets you edit the name of the Toolbox Item that the script item is linked to. By changing this you can switch the item to point at a different Custom Item in your Toolbox. Note: If you change the name of the Toolbox Item a custom item in your script is linked to to a non-existent item, it will still work, but it will lose it's link to the original item. This means that if you update the item in the Toolbox then the item in your script will not pick up the change.
Updating a Custom Toolbox Item
Once you have created a Custom Toolbox Item, you may wish to update it. You can do this by simply re-dragging the original item you used to create the Custom Item into your Toolbox again. If you give it the same name, Badboy will save over the original item and all the Custom Items in your script linked to that item will use the new version instead of the old one. If you don't have the original item that you saved then just place the Custom Item that you want to update in your script and then right click on it and select "Expand". The item will expand to show the original contents of the Custom Item. You can then edit the items and drag them back into the Toolbox to update them.
Your Toolbox File
Badboy stores all of your custom tools in a file. You may like to save and backup this file, or to share it with your colleagues.
In the current release, Badboy always stores the Toolbox in the file "toolcache.bbt" in the Badboy installation directory. Later releases will allow you to choose the location of your Toolbox file, and to switch between different Toolboxes if you wish.