Testing a different file than runtests.jl

Hello

I would like to specify a different file than runtests.jl when runing test from Pkg. Something like:

pkg> test file=anotherfile.jl

The file would still reside in the test directory. But that would allow me to avoid editing runtests.jl and commenting in/out lines like
include(“anotherfile.jl”).

Thanks for your help.

Not directly responsive to your question, but do take a look at the new test item framework in the VS Code extension, it allows you to run a very fine-grained selection of tests easily.

2 Likes

Thanks David.

How did you guess I was using VS code?

Anyway, how do I install the VS code extension? I have seen the option to install additional testing extensions but I see a long list of possibilities and nothing looking like testitems. Can you help?

It’s all baked into the Julia extension!

Oh, I didn’t, that is why I wrote that this is not really responsive to your question. I just wanted to point out an alternative.

And yes, the entire feature is just part of the Julia extension for VS Code, as @mrufsvold wrote.

1 Like

I am missing something.
I have version 1.7.12 as can be seen in the first screenshot.

In the second screenshot you can see a sentence in French saying: “Tests not found in this workspace”. Then I am told to “configure a test framework”. I guess that’s the part I did not do.

Then you see an irrelevant option for Python testing (God forbid)
Then an option to install further stuff.

Can you help? Please.

I think I got it.

The debugger needs to be started first.
Thanks. We can close this.

Hm, no, that should be entirely independent of the debugger. But the language server needs to finish its startup, and that sometimes takes a while.

You’re right about the debugger. I got the correct display for a while. Then I lost it.
The language server had plenty of time to start after 1 hour of trial.

I tested again this morning and checked the language server. It started without error. Still, nothing to see in the test section. A VS code bug maybe. I don’t know. I give up for now. I’ll comment out the files I don’t want to test.

Thanks for your patience.

Just dropping my testing workflow:

First, I test everything with (where TestEnv.jl is installed globally):

julia> using Pkg; Pkg.activate("."); using TestEnv; TestEnv.activate(); include("test/runtests.jl")

For any further test runs, I do:

julia> include("test/subtests.jl")
2 Likes

Exactly what I needed.

Thanks.

1 Like