So the idea with TDD is that you write the minimal amount of code that makes the tests pass, right?

And the tests passing are supposed to make me feel good?

Well then it doesn't work because I know my code is wrong and will cause issues further down the line and I can't not feel bad about it.

@wolf480pl

> ... the idea with TDD is that you write the minimal amount of code ...

In my experience, both the "test code" and "actual code" have to bent over backwards to allow for (unit) testing, especially when your "actual code" is side-effect heavy.

Anyone that had to `stubClock.advance(5, MINUTES)` can relate.

@michal I'm not writing unit tests. My actual code is a network server, so my tests interact with it over the network. Not sure if these count as end-to-end tests or more like integration tests... I'm trying to make them pretty exhaustive, testing each message type separately, with all the error handling and stuff, so that at the end I can throw away my actual code and end up with a protocol compliance testsuite.

@wolf480pl In that case a "spec check" is actually a nice thing to have, expecially if you anticipate multiple implementations. Makes it easy to judge how much of a feature set is available.

E.g. kaitai-struct has a set of checks [1] for different languages it's implementer in, for you (user) to see what features work and (language implementer) to see what needss fixing.

[1] https://github.com/kaitai-io/kaitai_struct_tests/tree/master/spec

kaitai_struct_tests/spec at master · kaitai-io/kaitai_struct_tests

Kaitai Struct: tests in all supported programming languages - kaitai_struct_tests/spec at master · kaitai-io/kaitai_struct_tests

GitHub
@michal hmm looks like they have separate tests for every language. As a library, it makes sense for them. But for me, having the tests interact with the tested code over the network is easier, this way it's only the test code that needs to bend over backwards :P

@wolf480pl It might actually be an advantage then. Have your "spec checker" receive a host:port argument and run a barrage of tests against it using the public API.

The next step would be exposing it as a public service, a-la https://federationtester.matrix.org/ :)

Matrix Federation Tester

@michal yup, that's the plan long-term.

After I finish prototyping and write down the spec.