The name's Bot, Otto Bot.
Otto started as a simple precept: What if there was a way to leverage automation tools to generate the keyword classes we use for automation? A number of my peers agreed and the original project was a top-7 finalist at my company's last hackathon! Furthermore, a truly kind soul gave me the go-ahead to open-source the project so I could continue to work on it outside of work (thanks again!).
So what does it do?
Simply put, Otto is being designed to take any webpage and parse its elements into keyword-class methods for access. Text boxes get both a Set/Verify, click-based elements get a Click command, etc. The idea is to remove as much of the manual work as possible that currently goes into generating keyword classes to be used later to write automated tests.
How does it work?
Otto is a combination of a couple helper js files, jQuery, and a C# back-end that all communicate via Selenium. In its current state, the js files rip the DOM into an xml-valid string and pass it down to the C# back-end. Here the string is parsed into an XDocument where it's processed and cut-down to only the relevant elements we want to automate. These elements are then ripped into validated jQuery statements and added into a dictionary. The dictionary of final elements is constantly deduped to ensure unique jQuery lookups per element and unique names for the keywords. Finally, this collection gets sent through a simple parser and can output both C# and VB.NET keyword classes.
Future work
- Better element discovery. It could always be faster, stronger, and more intelligent. In particular, there is still a bit of work left to be done for iFrames (may they burn in hell).
- User-designated filter lists for elements to keep/identify. Are your Click-based elements always an anchor tag? Are they only anchor tags and em tags? Or are they just input tags with type='submit'? Allowing the users to tell Otto what elements to watch for would be exceptionally helpful.
- User-designated regex filters. These would be applied against attributes to make them more correct and usable for multiple client installs. For example: some websites use auto-generated information in front an id attribute so you'd see id='auto_gen_1234_firstname'. I want to support regex filters per attribute type so Otto could turn that id into just 'firstname' and the automation could be run against a variety of installs for QA testing.
- Crawling. Once Otto's discovery engine is strong enough, I would love to extend the tool to then take the data it just discovered and crawl the site. Auto-generated automation making auto-generated automation. I, for one, welcome our new automation overlord!
Authors and Contributors
Currently Otto is just the pet project of Stephen McCusker (@Muckrucker). I'm always open for feedback, comments (good and/or bad), and anyone else who's interested. Thanks!