Sunday, 2 November 2008

RestFixture latest additions: JSON support and Sequence Diagrams Generation

RestFixture has been enhanced with two new features:

  • basic support for JSON;

  • runtime generation of sequence diagrams showing the flow of http calls within a table


First of all, thanks to AndyO as he is the author of the JSON support enhancements. Now RestFixture allows testers to write and verify expectations for content returned in JSON.

As for the second feature, the generation of sequence diagrams from a RestFixture table, the idea has been growing since i found UMLGraph, a nice tool that generates class and sequence diagrams. The idea is that for describing complex REST API interactions... a picture is worth a thousand words.

Here follows two simple diagrams and associated tables to demonstrate the generation of the diagrams.
Note that the diagrams are generated at execution time, therefore they reflect the actual outcome of the run of a RestFixture test. This means that if the test fails the picture shows the flow of messages that failed the test.


The diagrams are pretty basic and they only show the objects (or resources) involved, the verb, the return code and, for POST the id, taken from the Location header.

Full instructions on how to install the required software and how to use the new feature are available in the RestFixture web site.

Support for generation of the diagrams is basic. It has been extracted out of the main RestFixture trunk as it's still in spike mode. The code, though is checked in the same SVN trunk (the project is called PicBuilder).

As always comments are very welcome!!

8 comments:

Paul said...

Hi,
I am an absolute new to Fitnesse and want to use it for acceptance testing of a restful api I am building. I would love to use rest-fixture but I am having some difficulty getting started. The readme mentions editing the build.properties and building. Does that mean that I need to check out the project source? or is there a way that I can just use the rest-fixture with dependencies and get started? Any pointers you can give me are very much appreciated.

smartrics said...

Hi, you can download the compiled rest-fixture here:
http://code.google.com/p/rest-fixture/downloads/detail?name=RestFixture-1.0.zip

if you put the jar in the fitnesse classpath you should be able to go (see the included doc for usage samples.

Jayamini said...

Hi,
I have already used the restfixtures to test RESTful APIs and also column fixtures in testing non-restful APIs. Now I have this requirement of building a fitnesse acceptence test which uses a mix and match of restful APIs and non restful APIs. I also require to pass data between rest fixtures and column fixtures.
I have tried this by using a fitnesse test suite which includes two tests where one test is using a restfxture and the other test is using a column fixture.
however, im getting exceptions in the test which is using the non Restful APIs while the test which is using the restfixture is passing.
will you be able to help me with my problem? or may be suggest a better approach to tackle the requirement.
your feedback is very much appreciated!
-Erandathi.

smartrics said...

Passing data across fixtures can be achieved with FitNesse symbols.

I think your approach is fine, you should always use the most appropriate fixture for the test you need to write

M H J Bramwell said...

Hi,

A quickee, if I may...

Does the fixture support single (not multi-part) file upload with PUT?

Thanks,
Hasan

smartrics said...

Hasan, it does not.

M H J Bramwell said...

Thanks.

At the risk of being a nuisance...

... is there a way to test multiple file uploads in a single multi-part POST?

(I don't see it tested in FitTests.PostTests)

Hasan

smartrics said...

nope - but it should be fairly easy to add. all the infrastructure is there