When is it appropriate to use FitNesse testing versus Selenium testing?
Programmers can probably write Selenium tests in whatever language they write production code in, which can be incredibly powerful.
First, let's talk about the two tools.
I recommend Selenium to automate a Web-based user interface, such as Google Chrome, and FitNesse to define business logic tests in a table so that customers can understand them. Sometimes it is possible to combine the two, expressing the tests in a table, then having FitNesse connect to Selenium over a piece of "bridge" technology called Selenesse.
You can think of Selenium as an essential code library, or application programming interface, to drive the browser. That code library plugs into many languages, from Ruby to Python to Java, even .Net. That means your programmers can probably write Selenium tests in whatever language they write production code in, which can be incredibly powerful. You can write code in Selenium, for example, to take in a specific username, password and expected text, then click-type-click very specific fields. Once the programmers create the function, you can reuse it like so:
login(“email@example.com”,”abcd”,”Failed to Login or Username unrecognized”) ;
login(“firstname.lastname@example.org”,”abcd”,”Failed to Login or Username unrecognized”) ;
In the example above, the first user ID is a bad password, the second a bad email address, while the third passes, showing the welcome screen with a hello message.
The programmers can write a program that calls these functions and directs the output to the screen, then either run the program on command or possibly check it into their continuous integration server.
In order for a customer or less technical user to connect to this sort of check, they'd have to get into version control and read code. Asking what-if questions and re-running the tests might involve a line editor and compile step -- it is unlikely to happen.
FitNesse solves that by creating a "pretty" layer on a wiki, between the code and the user. A FitNesse test for login might look more like this:
Failed to log in or username unrecognized
|Failed to log in or username unrecognized|
When the users look at the code on the screen, it will look like a table; clicking Edit exposes the pipe symbol and allows the user to change values and save to ask what-if questions or add new tests.
Of course, with FitNesse, you have to connect to the underlying code somehow and write the login function. FitNesse supports .Net and Java natively, but you can also shell out to any computer program using the command line, then interpret the results that come back.
If you want to test a Web-based application by and for technical people, I'd suggest Selenium. If the purpose is to create executable specifications, especially at the business logic level, start with FitNesse. If the team codes a Web-based application in Java or .Net, you might just want both!
Dig Deeper on Topics Archive
Related Q&A from Matt Heusser
Common software security mistakes include testing at the last minute and not testing open source code and VMs. Expert Matt Heusser suggests ways to ... Continue Reading
You can't just 'do' DevOps and hope to get it right. Expert Matthew Heusser takes us through all the steps required to make DevOps work for your ... Continue Reading
Your boss wants you to 'do DevOps.' Expert Matthew Heusser offers time-tested advice for getting started down the DevOps process. Get ready for a lot... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.