[Twisted-Python] Autobahn WebSockets 0.4.3

Tobias Oberstein tobias.oberstein at tavendo.de
Mon Oct 31 18:25:05 EDT 2011


> > What do you want to test? Own client, own server?
> 
> I wanted to test Autobahn's internals. Unit tests, not integration tests. The
> integration test stuff is pretty cool, too, but I was hoping for tests which
> verify Autobahn's behavior internally.

You can use Autobahn to test Autobahn of course.

Autobahn's test approach is tailored towards it's domain (communication
protocols) and based on the following perspective:

If you have a black box, that behaves to a protocol spec regarding
all it's externally visible behavior, you can call that black box conforming
to the protocol.

Whether you then have unit tests for stuff that happens within the black
box is less relevant, as long as you have covered all the spec with
behavioral test cases.

When you only have unit tests for stuff happening inside the box,
you still can't say if the box conforms to the spec. It may pass all
unit tests and fail when talking to the world.

For protocols, the reason for this is: any unit test by definition
misses an essential part: the peer you communicate with.

As an example, instead of writing a unit test that checks whether
a UTF-8 decoding function raises upon invalid sequences, 
execute a fuzzing test case where the fuzzer will actually send
the tested implementation invalid UTF-8 and check the externally
visible behavior.



More information about the Twisted-Python mailing list