Hello, I'd like to create a Julia Test adapter. I'm kinda new so some help would be nice.
Running tests in Julia is simple for the most part, I'll try to describe it as thoroughly as possible;
We first need to find the root project, -> In Julia: No Project = No tests; Tests are essentially undefined for orphan scripts, tests will always try to find an environment to "containerize" and will fail if not found; While it is possible to test such scripts, it is a pain and is not recommended.
The project has a specific file structure: What matters to us is :
the test directory which contains the tests
src directory which contains the code
Project.toml the defined env for the project
Manifest.toml the current resolved env for the project
Tests are ran simply from a test/runtests.jl file, this file is then ran by the Test Runner; Some notes:
Tests are usually defined elsewhere and are called in runtests.jl, the calling can be either via a direct function call or through includeing a file.
Any tests not called in runtests.jl are not run
Tests may be grouped via the macro @testset followed by a block; begin is most common, though for is also very prevalent
The smallest unit is @test.
Some people also run their tests in an orphaned way, outside of functions and then just include the file in runtests.jl
The Package/Project tested via: julia --project -e "using Pkg; Pkg.test()"
And yes, --project is usually quite smart and will probably find the project no matter where you are inside the file tree.
Hello, I'd like to create a Julia Test adapter. I'm kinda new so some help would be nice.
Running tests in Julia is simple for the most part, I'll try to describe it as thoroughly as possible;
We first need to find the root project, -> In Julia: No Project = No tests; Tests are essentially undefined for orphan scripts, tests will always try to find an environment to "containerize" and will fail if not found; While it is possible to test such scripts, it is a pain and is not recommended.
The project has a specific file structure: What matters to us is :
test
directory which contains the testssrc
directory which contains the codeProject.toml
the defined env for the projectManifest.toml
the current resolved env for the projectTests are ran simply from a
test/runtests.jl
file, this file is then ran by the Test Runner; Some notes:include
ing a file.@testset
followed by a block;begin
is most common, thoughfor
is also very prevalent@test
.Some people also run their tests in an orphaned way, outside of functions and then just include the file in
runtests.jl
The Package/Project tested via:
julia --project -e "using Pkg; Pkg.test()"
And yes,--project
is usually quite smart and will probably find the project no matter where you are inside the file tree.