File organization and naming for tests

I am looking for a way of organizing test/ directories for large projects, mainly because if I settled on a way then I would not have to think about it :wink: (I found this topic which is loosely related.)

To make things concrete, suppose there is a project with

src/
    Paper.jl
    parameters.jl
    model.jl
    solution.jl
    inference.jl

I generally would have a test file for each file in the src/, and in test I would also need some code, let’s call it utilities.jl, which just sets up simulated parameters and data. Eg possibly

test/
    runtests.jl
    support/
        utilities.jl
    parameters.jl
    model.jl
    solution.jl
    inference.jl

Some questions I am thinking about:

  1. whether test utilities should go into a separate directory, or even multiple directories, and what to name them,

  2. whether filenames should be the same for code and tests, or prefix tests with eg test_.

I don’t really have any input for the full question, but I think it is easier to identify problems when the filenames differ, e.g. when quickly looking at a stacktrace from an error.

1 Like