Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Fit/FitNesse?

Tags:

What's the point of using Fit/FitNesse instead of xUnit-style integration tests? It has really strange and very unclear syntax in my opinion.

Is it really only to make product owners write tests? They won't! It's too complicated for them. So why should anyone Fit/FitNesse?

Update So it's totally suitable for business-rules tests only?

like image 789
Artem Tikhomirov Avatar asked Feb 28 '09 23:02

Artem Tikhomirov


People also ask

What is the purpose of the fixture in FitNesse?

A fixture is the class that FitNesse and Slim use to process a particular test table when the Test button is clicked. For each row of data in a test table, Slim sets its inputs using setter methods, and then calls the specified output methods.

What is a FitNesse test?

FitNesse testing tool is an open source testing tool used to conduct acceptance testing. Acceptance testing is a black box testing or functional testing. It used to evaluate the system's compliance with the business requirements. It verifies that the software is behaving up to the expectation of the end user.

What does SLIM stands for in FitNesse?

(SLIM – Stands for Simple List Invocation Method. By saying SLIM test system, all the table processing is done by FitNesse.


1 Answers

The whole point is to work with non-programmers, often even completely non-technical people like prospect users of a business application, on what application should do and then put it into tests. While making tests work is certainly too complicated for them, they should be able to discuss tables of sample data filled out in e.g. Word. And the great thing is, unlike traditional specification, those documents live with your application because automated tests force you to update them.

See Introduction To Fit and Fit Workflow by James Shore and follow links to the rest of documentation if you want.


Update: Depends on what you mean by business rules? ;-) Some people would understand it very narrowly (like in business rules engines etc), others---very broadly.

As I see it, Fit is a tool that allows you to write down business (as in domain) use cases with rich realistic examples in a document, which the end users or domain experts (in some domains) can understand, verify and discuss. At the same time these examples are in machine readable form so they can be used to drive automated testing, You neither write the document entirely by yourself, nor requre them to do it. Instead it's a product of callaboration and discussion that reflects growing understanding of what application is going to do, on both sides. Examples get richer as you progress and more corner cases are resolved.

What application will do, not how, is important. It's a form of functional spec. As such it's rather broad and not really organized by modules but rather usage scenarios.

The tests that come out of examples will test external behavior of application in aspects important from business point of view. Yes, you might call it business rules. But lets look at Diego Jancic's example of credit scoring, just with a little twist. What if part of fit document is 1) listing attributes and their scores and then 2) providing client data and checking results, Then which are the actual business rules: scoring table (attributes and their scores) or application logic computing the score for each client (based on scoring table)? And which are tested?

Fit/FitNesse tests seem more suitable for acceptance testing. Other tests (when you don't care about cooperation with clients, users, domain experts, etc., you just want to automate testing) probably will be easier to write and maintain in more traditional ways. xUnit is nice for unit testing and api tests. Each web framework should have some tool for web app/service testing integrated in its modify-build-test-deploy cycle, eg. django has its little test client. You've lots to chose from.

And you always can write your own tool (or preferably tweak some existing) to better fit (pun intended) some testing in your particular domain of interest.


One more general thought. It's often (not always!!!) better to encode your tests, "business rules" and just about anything, in some form of well defined data that is interpreted by some simple, generic piece of code. Then it's easy to use the data in some other way: generate documentation, migrate to new testing framework, port application to new environment/programming language, use to check conformance with some external rules or other system (just use your imagination). It's much harder to pull such information out from code, eg. simple hardcoded unit tests or business rules.

Fit stores test cases as data. In very specific format because of how it's intended to be used, but still. Your domain specific tests may use different formats like simple CSV, JSON or YAML.

like image 188
Tomek Szpakowicz Avatar answered Oct 19 '22 12:10

Tomek Szpakowicz