[Clock] How about to split tests to several files?

Hi team,

The exercise Clock has many test cases for each property: create, add/subtract, equals. I noted that in Java track they divided all test cases among three test files.

This is a fragment of config.json

  "files": {
    "solution": [
      "src/main/java/Clock.java"
    ],
    "test": [
      "src/test/java/ClockAddTest.java",
      "src/test/java/ClockCreationTest.java",
      "src/test/java/ClockEqualTest.java"
    ],

I’m tending to follow this approach for AWK track.

There are pros and cons for both approaches—keeping all test cases in one file or dividing them into multiple.

There is one more option possible: to create one test case for a property and send all test data at once. Like this (all test cases for CREATE property):

8 0
11 9
24 0
25 0
100 0
1 60
0 160
0 1723
25 160
201 3001
72 8640
-1 15
-25 0
-91 0
1 -40
1 -160
1 -4820
2 -60
-25 -160
-121 -5810

and expect the output to be like this

08:00
11:09
00:00
01:00
04:00
02:00
02:40
04:43
03:40
11:01
00:00
23:15
23:00
05:00
00:20
22:20
16:40
01:00
20:20
22:10

However I think it is better test by one but not in batch.

I would like to hear your opinion.

The sample solution for this exercise is as follows:

I think one long test file with one test case for each test is fine. I don’t think it needs to be split across files nor do I think tests should be batched.

1 Like