iriusrisk / bdd-security

BDD Automated Security Tests for Web Applications
http://www.continuumsecurity.net/bdd-intro.html
GNU Affero General Public License v3.0
559 stars 178 forks source link

Use groovy script to define the WebDriver steps #43

Open iriusrisk opened 8 years ago

iriusrisk commented 8 years ago

This relates to the cukesecure branch, not the master branch of BDD-Security.

Currently, the framework reads the config.xml file and loads the Java class define in the tag: e.g.: <class>net.continuumsecurity.examples.ropeytasks.RopeyTasksApplication</class>

This class then implements interfaces like ILogin, ILogout etc that are used during the testing process. But since this is a Java class the user needs to compile it and then run the framework. For users who would like a more dynamic approach, it would be easier to supply a groovy script at runtime which can be provided external to the framework. In the future, this will allow us to dockerize the whole framework and then provide the groovy script as a parameter to docker.

Steps required for this:

  1. remove the tag from config.xml and use a hard coded class name: AppDefinition
  2. expect to find the class either in the root of the project ./AppDefinition.groovy or specified in the Property AppDefinition.
  3. Dynamically load the groovy script

This means that the user should be able to run ./gradle -Dtest.single=AuthenticationTest -DAppDefinition=/home/somewhere/AppDefinition.groovy

The rest of the framework should work as it does now.

iriusrisk commented 8 years ago

To clarify further. The AppDefinition.groovy file should replace the current RopeyTasksApplication.java file. The AppDefinition.groovy file should contain all the same methods and contents from the current RopeyTasksApplication.java file.