Adds XAuth functionality and refactors test code to use a BDD style