# Testing a different file than runtests.jl

**URL:** <https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789>\
**Category:** Package Management\
**Tags:** package, testing\
**Created:** [September 25, 2022, 7:33pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789 "2022-09-25T19:33:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [September 25, 2022, 7:33pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/1 "2022-09-25T19:33:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [September 25, 2022, 7:51pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/2 "2022-09-25T19:51:26Z")

</div>

Not directly responsive to your question, but do take a look at the new [test item framework](https://discourse.julialang.org/t/prerelease-of-new-testing-framework-and-test-run-ui-in-vs-code/86355) in the VS Code extension, it allows you to run a very fine-grained selection of tests easily.

---

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [September 25, 2022, 8:20pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/3 "2022-09-25T20:20:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [September 25, 2022, 11:25pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/4 "2022-09-25T23:25:13Z")

</div>

It’s all baked into the Julia extension!

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [September 25, 2022, 11:31pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/5 "2022-09-25T23:31:43Z")

</div>

> [@dgagnon](#):
>
> How did you guess I was using VS code?

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.

---

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [September 26, 2022, 9:33pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/6 "2022-09-26T21:33:08Z")

</div>

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

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/e/fea4f04616ea468fdff7b1c6fc6e35a9bb0200fb.png)

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.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/7/17d94c24a2a39f305b696e55927911c39a747a70.png)

---

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [September 27, 2022, 1:00am UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/7 "2022-09-27T01:00:56Z")

</div>

I think I got it.

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

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [September 27, 2022, 1:18am UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/8 "2022-09-27T01:18:58Z")

</div>

> [@dgagnon](#):
>
> The debugger needs to be started first.

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.

---

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [September 27, 2022, 11:33am UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/9 "2022-09-27T11:33:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Post date:** [September 27, 2022, 2:26pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/10 "2022-09-27T14:26:25Z")

</div>

Just dropping my testing workflow:

First, I test everything with (where [TestEnv.jl](https://github.com/JuliaTesting/TestEnv.jl) is installed globally):

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

```

For any further test runs, I do:

```julia
julia> include("test/subtests.jl")

```

---

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [September 30, 2022, 9:04pm UTC](https://discourse.julialang.org/t/testing-a-different-file-than-runtests-jl/87789/11 "2022-09-30T21:04:17Z")

</div>

Exactly what I needed.

Thanks.
