For our demonstration I will be using Apache’s ActiveMQ, the most popular cross platform JMS provider. It’s open source product so please go ahead and download it from ActiveMQ download page. Once downloaded just unzip the installer zip file and start running activemq process from inside activemq-install-dir/bin directory.
Posted in acceptance tests, fitnesse, generic fixture, java, jms, tdd, test driven development | Tagged fitnesse, generic fixture, java, jms, tdd, test driven | 1 Comment »
As I have mentioned in my Introduction to Generic Fixture post that we can use Generic Fixture to write acceptance tests to validate almost any type of Java application. In my previous posts I demonstrated how to make use of Generic Fixture to write automated web tests and testing EJBs. Let’s now see how to use Generic Fixture for writing queries against an Oracle database.
We shall keep the database connection parameters in a separate SetUp page as well as the connection closing code in a separate TearDown page. After that we shall write our query in main test page. That way we can utilize SetUp and TearDown pages in all of our test pages without repeating that code again and again in for each test.
I am assuming that your FitNesse server process is running on localhost on post 8000. If that is not the case then please change the URLs accordingly.
To test a database we shall need the database vendor supplied JDBC driver to be able to make JDBC calls. In this example since we are using Oracle we are going to need Oracle’s JDBC driver jar file. You can place your JDBC driver jar file anywhere on your system where FitNesse server is running and give the path in !path directive of FitNesse. Continue Reading »
Posted in acceptance tests, database, database testing, fitnesse, generic fixture, java, oracle, query, tdd, test driven development | Tagged database, fitnesse, generic fixture, oracle, test driven development | 2 Comments »
| myVar=method1 | arg1 | arg2 | | returnValue |
….
….
or You can use a variable “params” in a test table like this to store the SUT (System Under Test, which is a HashMap here) itself:
!| Generic Fixture | params=java.util.HashMap |
| put | curr_id | 128 |
| size | | 1 |
| toString | |
and later to use this variable myVar in an argument list use this syntax:
| method2 | myVar= | arg2 | | returnValue |
….
or to use this variable myVar in return value use this syntax:
| method3 | arg1 | | myVar= |
….
or You can even use this variable myVar to instantiate a new class, use this syntax:
!| Generic Fixture | myClass | myVar= |
….
Continue Reading »
Posted in acceptance tests, fitnesse, generic fixture, java, tdd, test driven development, variable | Tagged fitnesse, generic fixture, java, tdd, test driven development, variables | 1 Comment »
Posted in DSL, acceptance tests, fitnesse, generic fixture, java, selenium, tdd, test driven development, variable, web testing | Tagged DSL, fitnesse, generic fixture | 7 Comments »
Here is a sample Java code of a typical EJB client. Any Java developer who has ever written code to call EJBs will be well aware of following Java code snippet.
Posted in EJB, acceptance tests, fitnesse, generic fixture, java, tdd, test driven development, variable | Tagged automated acceptance tests, fitnesse, generic fixture, java, tdd, test driven development | Leave a Comment »
Download FitNesse
Go to http://fitnesse.org/FitNesseDevelopment.DownLoad and download the the “Full Distribution (fitnesse200#####.zip)”. Unpack the zip into c:\program files. Once extracted you must have a directory c:\program files\fitnesse.
Download Selenium Remote Control (Selenium RC)
Go to http://selenium-rc.openqa.org/download.jsp and download the latest version (1.0-beta-2 at the time of writing this page). Unpack the zip into c:\program files. Once extracted you must have a directory c:\program files\selenium. Current version for Selenium-RC is 1.0-beta-2 and these instructions are written assuming you are using this version.
Create a smart start script
Copy and paste following script into a file called run.vbs under the directory “C:\Program Files\selenium\selenium-remote-control-1.0-beta-2\selenium-server-1.0-beta-2″. This script will start both FitNesse servers and Selenium remote control servers on their default ports 8000 and 4444 respectively. This script will ONLY start these processes if these processes are not running, so this script can be safely run any time.
PS: Please note that this script is starting Selenium in an experimental Proxy Injection Mode which lets you run your web test across multiple domains. If you don’t want to use this feature feel free to change this start script.
Posted in DSL, acceptance tests, download, fitnesse, generic fixture, install, java, selenium, tdd, test driven development, variable, web testing | Tagged automated acceptance tests, download, fitnesse, generic fixture, install, java, selenium, tdd, test driven development | 5 Comments »
For testing business logic in my back end applications I mostly used ColumnFixture, TableFixture and RowFixture for defining inputs and output data sets. All I needed to write was a thin adapter or mapper Java class that extends any of these fixtures. That thin adapter Java class just gets input data from wiki and use that data to make a call to my back end application. At the end of the call it just makes the result available for FitNesse to display on wiki page. This thin adapter class is fully Fixture aware and developer of this class must know how to map data between back end application and FitNesse front end wiki page.
So far so good no major complains here, it worked great for us.
But I found this requirement to write the thin fixture adapter class for each new transaction a little annoying and have always toyed with the idea of building a generic Table/Fixture, one that will not require a developer to understand and be aware of the various fixtures coding conventions. In other words a fixture/table style where testers can write acceptance tests without needing development support of writing fixture specific code for each new transaction.
That became the main driving force behind the thought of developing a Generic Fixture where you just drop your class in FitNesse’s class path, write your test tables in wiki and be ready to test without having to write a single line of Java code. This idea is simple enough to understand but not so simple to implement because of the complexity of Java classes. Each class is different, it can have various type of constructors and methods (even overloaded ones). Each method can be returning different type of values (or not returning at all if method is void). We have to define some rules of defining class names, constructors, method names and their return types on wiki test tables first.
Posted in acceptance tests, fitnesse, generic fixture, install, java, selenium, tdd, test driven development, web testing | Tagged automated acceptance tests, fitnesse, generic fixture, java, tdd, test driven development | 13 Comments »
Install Requirements
You must have FitNesse framework installed on your computer and FitNesse server must be running on the computer where Generic Fixture is being installed.
To download Generic Fixture
Download the jar file genericfixture.jar containing full source code and compiled classes from Generic Fixture Sourceforge Site. Included classes have been generated using Sun’s JDK 1.5 Java compiler. Should you need to build Generic Fixture with any other JVM then make sure to put fitnesse.jar and fitlibrary.jar (provided in all the Fitnesse releases) in your CLASSPATH.
Continue Reading »
Posted in acceptance tests, download, fitnesse, generic fixture, install, java, tdd, test driven development | Tagged automated acceptance tests, download, fitnesse, generic fixture, install, java, tdd, test driven development | Leave a Comment »