Skip to content

Commit 62b5b47

Browse files
authored
Merge pull request #23 from UCL-ARC/1-unit-testing-feature-list
Add template testing feature matrix and update testing documentation
2 parents 878fed9 + 549a9f8 commit 62b5b47

File tree

3 files changed

+44
-28
lines changed

3 files changed

+44
-28
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ This will produce executables for the two src codes, `fortran-tooling-mesh-gener
6262

6363
## Running the tests
6464

65-
To run the tests run `ctest` from within the `build` directory.
65+
To run the tests, from within the `build` directory, run the following.
66+
```sh
67+
$ ctest
68+
```

testing/README.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,35 @@ There are several examples of good unit testing tools for other languages, such
1111

1212
These will be used as the basis for what the recommended Fortran unit testing tool should look like. Therefore, key features from these tools shall be individually tested for each Fortran unit testing tool we select to test.
1313

14-
## Aims
15-
- Test multiple fortran unit testing tools to determine which we would recommend. To do this we will
16-
1. [ ] Create a list of features that should be present in a "good" unit testing tool.
17-
2. [ ] Write tests to cover each of the key features determined in the previous step.
18-
- [ ] [test-drive](./tests/test-drive)
19-
- [ ] [pFUnit](./tests/pFUnit)
20-
- Build template implementations for the tools we recommend.
14+
## Running all of the tests
15+
16+
All of the test can be ran from within the build directory with the command `ctest`. However, there is a known issue that the tests for test-drive itself will also be ran, as shown below.
17+
```sh
18+
$ ctest
19+
Test project /Users/connoraird/work/fortran-tooling/build
20+
Start 1: fortran-tooling-test-drive/mesh_generator
21+
1/4 Test #1: fortran-tooling-test-drive/mesh_generator ... Passed 0.33 sec
22+
Start 2: test-drive/all-tests
23+
2/4 Test #2: test-drive/all-tests ........................ Passed 0.33 sec
24+
Start 3: test-drive/check
25+
3/4 Test #3: test-drive/check ............................ Passed 0.01 sec
26+
Start 4: test-drive/select
27+
4/4 Test #4: test-drive/select ........................... Passed 0.01 sec
28+
29+
100% tests passed, 0 tests failed out of 4
30+
31+
Total Test time (real) = 0.69 sec
32+
```
33+
34+
## Template Features matrix
35+
36+
Compilers tested: *A list of compilers we have tried with these tests*
37+
38+
| Feature | Implemented natively | Implemented manually |
39+
|---------|----------------------|----------------------|
40+
| Can run individual tests | Yes or No (explanation) | Yes or No (explanation) |
41+
| Mocking | Yes or No (explanation) | Yes or No (explanation) |
42+
| Stubbing | Yes or No (explanation) | Yes or No (explanation) |
43+
| Data driven tests | Yes or No (explanation) | Yes or No (explanation) |
44+
| Coverage report | Yes or No (explanation) | Yes or No (explanation) |
45+
| Skip tests | Yes or No (explanation) | Yes or No (explanation) |

testing/test-drive/README.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,14 @@ This project offers a lightweight, procedural unit testing framework based on no
33

44
## Running the tests
55

6-
The test-drive tests will run with the rest of the [tests](../README.md#running-the-tests) in the repo.
7-
8-
There is a known issue that the tests for test-drive itself will also be ran by `ctest` as shown below
6+
All of the tests written with test-drive can be ran by following [#running all of the tests](../README.md#running-all-of-the-tests). However, we can also run a single testsuite or an individual test directly using the test executable. For example to run the `mesh_generator` tests we can run
97
```sh
10-
$ ctest
11-
Test project /Users/connoraird/work/fortran-tooling/build
12-
Start 1: fortran-tooling-test-drive/mesh_generator
13-
1/4 Test #1: fortran-tooling-test-drive/mesh_generator ... Passed 0.33 sec
14-
Start 2: test-drive/all-tests
15-
2/4 Test #2: test-drive/all-tests ........................ Passed 0.33 sec
16-
Start 3: test-drive/check
17-
3/4 Test #3: test-drive/check ............................ Passed 0.01 sec
18-
Start 4: test-drive/select
19-
4/4 Test #4: test-drive/select ........................... Passed 0.01 sec
20-
21-
100% tests passed, 0 tests failed out of 4
22-
23-
Total Test time (real) = 0.69 sec
8+
$ <root of repo>/build/testing/test-drive/test_fortran-tooling-test-drive mesh_generator
9+
```
10+
and to run the single `mesh_generator` test `test_calculate_mesh_parameters_5_1`
11+
```sh
12+
$ <root of repo>/build/testing/test-drive/test_fortran-tooling-test-drive mesh_generator test_calculate_mesh_parameters_5_1
2413
```
25-
2614

2715
## Features matrix
2816

@@ -33,9 +21,9 @@ Compilers tested: gfortran (homebrew)
3321
| Can run individual tests | No | Yes, see [main.f90](./main.f90). However, this requires running the test executable directly without ctest. |
3422
| Mocking | No | Not implemented |
3523
| Stubbing | No | Not implemented |
36-
| Data driven tests | No | Yes, see verify_calculate_mesh_parameters and verify_calculate_mesh in [test_mesh_generator.f90](./test_mesh_generator.f90)
24+
| Data driven tests | No | Yes, but this is very cumbersome. See `verify_calculate_mesh_parameters` and `verify_calculate_mesh` in [test_mesh_generator.f90](./test_mesh_generator.f90)
3725
| Coverage report | Yes, with fpm | N/A |
38-
| Skip tests | Yes, see test_skip_example in [test_calc_pi.f90](./test_mesh_generator.f90) | N/A |
26+
| Skip tests | Yes, see `test_skip_example` in [test_mesh_generator.f90](./test_mesh_generator.f90) | N/A |
3927

4028
## Pros
4129
- Lightweight, procedural unit testing framework based on nothing but standard Fortran.

0 commit comments

Comments
 (0)