Stream: helpdesk (published)

Topic: ✔ Unit testing example


view this post on Zulip Sebastien Marie (semarie) (Feb 25 2024 at 13:41):

I am searching some examples to organize my code to have unit testing (using Base.Test)

view this post on Zulip Sebastien Marie (semarie) (Feb 25 2024 at 13:42):

just putting code inside the module with @testset isn't ideal, as the tests are run when importing/using the module

view this post on Zulip Sukera (Feb 25 2024 at 14:37):

put them in test/runtests.jl

view this post on Zulip Sukera (Feb 25 2024 at 14:37):

this file is executed when you do ]test in that project

view this post on Zulip Sukera (Feb 25 2024 at 14:39):

see also https://pkgdocs.julialang.org/v1/creating-packages/#Adding-tests-to-the-package

view this post on Zulip Sebastien Marie (semarie) (Feb 25 2024 at 15:02):

thanks, it was what I am searching !
I missed the ]test part

view this post on Zulip Notification Bot (Feb 25 2024 at 15:02):

Sebastien Marie (semarie) has marked this topic as resolved.

view this post on Zulip ederag (Feb 25 2024 at 17:56):

For a nice complement, see also https://modernjuliaworkflows.github.io/sharing/#testing


Last updated: Dec 28 2024 at 04:38 UTC