Feedback - aaronuurman/TestWriting_TranslationsHomeWork GitHub Wiki

Sander S.:

Oh, cool. The code is nice and clean – of all who have sent theirs, this is the most readable. Nice!

The test mechanics are all nice as well. There are two aspects that could benefit from more attention in the future:

• The choice of test cases is a bit too much cofused on the API technicalities. For a dictionary, all the linguistic aspects are going to be the most valuable to test, as those are where all real world usage concentrates. “null as input throws exception” style tests are very low value – I would not even create such tests. Instead, I would expect focusing on the potential troubles that languages can bring. It is good that you had some Russian alphabet but things like case-sensitivty and words becoming multiple words in a different language would also be relevant (e.g. USA -> “Ameerika Ühendriigid” style). The payoff is in the tests that simulate real world usage. No need for less impactful “technical” tests. I think 4-5 good realistic tests would be a perfect set for such a dictionary. • The tests involve quite a lot of code, which starts to get into maintainability issues. I find that in such cases it is useful to define some shared variables in the class for commonly used test data. For example:

Private static readonly Translation1 = new Translation { … } Private static readonly Translation2 = new Translation { … } Private static readonly Translation3 = new Translation { … }

And then in each test you can just do

.Translations.AddRange(new[] { Translation1, Translation2, Translation3 })

And thus avoid repeating all that stuff everywhere. This is especially important if you change the data structures and then have to change 50 tests… that can be very demotivating if such shared data is not defined in one place!

Otherwise, good work. We’ll definitely go into more depth about how to focus test cases on real world functionality in the sessions to come!