Bastard (Big Automated Scenario-Test Active Runtime-Director)

UPDATE: The source code of bastard lib is now available http://www.box.net/shared/q0f90dmmx4

Anything goes just to have a nasty-sounding product name, eh? :D

Ok, so this entry is highly related to the previous entry where I post a documentation that explains (mostly) the format of the XML file in which you describe your test scenario. In this entry I'm posting the Java library I wrote that consumes the XML and runs the scenario. Download it from here: http://www.box.net/shared/nfns0u79k9 .

Well, it's not the library per se. Instead it's a little test project that uses the library. The library itself is included in that project (look for a file named bastard_api.jar in that ZIP; that's the library you would import into your project).

Alright, time for a quick explanation. Basically you will have to create a little program -- which I refer to as "Director" -- in order to use the Bastard API. It is typically very simple. Basically what it does are: (1) Loads the content of the XML file (whose name is passed in as an argument to the program execution). Then you (2) feed that XML string into a method named loadScenarioDef that belongs to the library class named ScenarioRunner. In return you will get an instance of ScenarioDefinition. Further you (3) create an instance of ScenarioRunner and spawn a thread to run it. There's an instance method named run that belongs to ScenarioRunner, into which you will have to pass the scenario definition you created in step 1 and the instance of mediator (see the doc in the previous entry to understand the meaning of it) .

Some screenshots...:

Step (1)

frijoldirector_01

Step (2)

frijoldirector_02

Step (3)

frijoldirector_03

As you see in the screenshot of step 1, you will have to pass the path to the scenario XML file as the argument to the program execution. The project comes with several XML files that you can use to play with. Try duh.xml first (for its nice name). If you’re using Netbeans, use the following screenshot as a reference.

frijoldirector_05

By running FrijolDirector with duh.xml, you should see this in the output console:

frijoldirector_04

Okay. That’s all for today. Feel free to mail me in case you have trouble running / trying / using it. Saludos.