As I mentioned in my last post, this post will discuss installing FitNesse, Selenium and Xebium. Xebia maintains good installation instructions at Xebium’s Github site, which I recommend you start with. You will download the code, compile and run it. This will get you running quickly.
So why write an extra installation post? Because I think compiling the code every time you start Xebium is a bit much, and of course to provide some extra quick hints and tips.
So once you’ve thoroughly tested FitNesse and Xebium and decide you want to use this framework for maintaining and abstracting your Selenium tests, how do you install it?
First, we’re going to build a JAR file and batch scripts to run it. This can be done by running Maven with mvn -Pjar-with-dependencies package
in your Xebium source directory. This will produce a JAR file in your /target
directory, which you can execute using java -cp xebium-0.x.jar fitnesseMain.FitNesseMain
. If port 80 is already in use on your machine, specify an extra -p 8080
switch to change the port.
For easy access, put this in a .bat or .sh file and set a job for starting this batch file at machine startup, using either Windows Task Scheduler or cron jobs.
Running your tasks nightly
To run your tasks nightly, create an extra task which runs every night at a given time. Have it start the following batch file:
cd C:MyFitNesseFolder
java -cp xebium-0.x.jar fitnesseMain.FitNesseMain -p 1234 -c "MyFirstTestSuite?suite"
In this batch file, port 1234 can be changed, as long as it is an unused port. This batch file starts a new FitNesse instance and, using the -c
command line switch, starts the tests in test suite MyFirstTestSuite. More on the -c
switch can be found on the FitNesse User Guide CommandLineTestRunner page.
Some other tips
First, the elephant in the room: Install your testing framework on a server, not on your workstation or laptop. This will allow the rest of the team access without your machine present. As FitNesse includes a webserver, you won’t need anything else, apart from configuring your firewall. Note that FitNesse also has advice on which machine to put your installation, although Virtual Wikis appear to be deprecated.
Next, to increase traceability in your development and testing team, secure your FitNesse with a login and password for each user. This can be found in FitNesse’s User Guide at the PasswordFile page. This will allow you to check who changed the test, so you can ask him why he did it. Not perfect for traceability, but at least a step up. You can of course also use this to secure your FitNesse.
6 comments
Rogier, I followed your steps to set up the Xebium/fitnesse, however, I am not able to get my tests to run. Once I start the test, the Stop icon appears, however, none of the scenarios get run. One other thing is, when I click the Stop icon, the test does not stop.
I was able to follow the Xebium instructions to get my tests running, however, I need to be able to run nightly builds from the command line, and I haven’t figured how to do that with their setup.
Any suggestions/help will be much appreciated.
Mark Geiger
Thanks for your feedback, Mark. I reproduced your problem and saw my FitNesse also fail to respond to anything. The cause was this post didn’t include instructions on what settings to add inside FitNesse. Sorry, my mistake!
Because the settings were a bit much to type in a comment, I made a new post about what settings to add. You can find it at https://blogs.infosupport.com/my-first-xebium-fitnesse-selenium-test/. Let me know if you need any more help!
Rogier van het Schip
Rogier
I followed your instructions. But I got a ‘xebium-0.7-SNAPSHOT-jar-with-dependencies.jar’ file instead of one labelled xebium-0.7.jar
When i ran it i got the following error. What am I doing wrong?
————————————————————————-
aditya@Aditya-Y:~/xebia-Xebium/xebia-Xebium-574edb8/target$ java -cp xebium-0.7-SNAPSHOT-jar-with-dependencies.jar fitnesseMain.FitNesseMain
Exception in thread “main” java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at fitnesse.WikiPageFactory.makeRootPage(WikiPageFactory.java:27)
at fitnesseMain.FitNesseMain.loadContext(FitNesseMain.java:113)
at fitnesseMain.FitNesseMain.launchFitNesse(FitNesseMain.java:36)
at fitnesseMain.FitNesseMain.main(FitNesseMain.java:27)
Caused by: java.io.IOException: make directory failed: ./FitNesseRoot
at util.DiskFileSystem.makeDirectory(DiskFileSystem.java:13)
at fitnesse.wiki.FileSystemPage.createDirectoryIfNewPage(FileSystemPage.java:263)
at fitnesse.wiki.FileSystemPage.(FileSystemPage.java:32)
… 8 more
Aditya
Sorry. I resolved that.
But the page that opens is the fitnesse page not the xebium page. Why?
Aditya
Hi Aditya,
I don’t have a working environment here with me to try, but I have a theory: FitNesse stores its pages in a subdirectory named FitNesseRoot. After packing the Xebium code in a jar, the original FitNesseRoot that is delivered with Xebium’s source is no longer in the directory from which you run the jar. Therefore, the default empty FitNesse page is shown.
When you run Xebia’s
mvn -Pfitnesse test
, this directory IS available, as you’re running the code from the source dir. Copying the directory from your source dir to the directory you run the jar from should help.Let me know if this doesn’t help.
Best regards,
Rogier
Rogier van het Schip
Thanks Rogier. It worked Perfectly
Aditya