@bradwilson I've been making a torrent client in Go. The hardest thing so far was coming up with a clean and logically separate code (which I haven't done yet 😆), but also I had problems with writing tests which can test the entire system.
To validate that the client is working, I have to spin up real qBittorrent clients, so I use Docker in my tests.
It's hard to articulate my thoughts. It was easy to write a bencode parser with TDD, but everything else is a hassle.
@bradwilson I started doing TDD through https://github.com/quii/learn-go-with-tests which I recommend a lot.
Anyway, it recommends writing acceptance tests first, so I wrote a test to download a file from a torrent peer. The implementation itself is ultra-rudimentary, right in TDD spirit. However, it has been hard to follow it up with good, structured code which is cleanly separated and tested.
Should I have to keep design separate from TDD and come up with a solid design up-front or am I doing something wrong?
@observer11 To me, the primary thing that differentiates TDD from "test after" isn't when you write the tests, but why.
I like to call TDD "Design by Example", where the example is executable code. At the API level (testing an individual function), this means writing the test to show how you'd like to consume the function in question, and what the impact of calling that function is (directly, via return value, or indirectly, via interaction with other aspects of your software.