# Recommended vscode workflow to run a module's tests interactively

**URL:** <https://discourse.julialang.org/t/recommended-vscode-workflow-to-run-a-modules-tests-interactively/73311>\
**Category:** VS Code\
**Tags:** testing, plotting\
**Created:** [December 18, 2021, 11:26pm UTC](https://discourse.julialang.org/t/recommended-vscode-workflow-to-run-a-modules-tests-interactively/73311 "2021-12-18T23:26:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![claforte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/claforte/32/19115_2.png) [@claforte](https://discourse.julialang.org/u/claforte)\
**Post date:** [December 18, 2021, 11:26pm UTC](https://discourse.julialang.org/t/recommended-vscode-workflow-to-run-a-modules-tests-interactively/73311/1 "2021-12-18T23:26:30Z")

</div>

Hi, I’m trying to run my module’s test line-by-line in vscode (as I used to when I had all my code in 1 file), so I can experiment with the REPL, and see the results of plots.

More specifically, I opened runtests.jl:

- [https://github.com/claforte/RayTracingWeekend.jl/blob/main/test/runtests.jl](https://github.com/claforte/RayTracingWeekend.jl/blob/main/test/runtests.jl)  
… and I `] activate`d `RayTracingWeekend/test`.

(BTW I verified that these tests run with `] test`.)

But I bump into 2 problems:

1. on the first line, `using RayTracingWeekend`, I get an `ArgumentError: Package RayTracingWeekend not found in current path`. I’m not sure how to best fix this issue, i.e. allow using the parent module.

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

1. When I try to run a single line within a test, using Shift-Enter, it runs the whole test. CTRL-Enter too. How can I run line-by-line, e.g. to see the plot of `gradient(20,10)` in the final line of that test?

Thank you very much!

---

<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:** [December 19, 2021, 2:03am UTC](https://discourse.julialang.org/t/recommended-vscode-workflow-to-run-a-modules-tests-interactively/73311/2 "2021-12-19T02:03:07Z")

</div>

Regarding the first part’ For testing there is the great [TestEnv](https://github.com/JuliaTesting/TestEnv.jl) package which should at least fix missing dependencies problems. So you activate your general environment of that package and then invoke the TestEnv activate function.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [December 19, 2021, 9:50am UTC](https://discourse.julialang.org/t/recommended-vscode-workflow-to-run-a-modules-tests-interactively/73311/3 "2021-12-19T09:50:55Z")

</div>

> [@claforte](#):
>
> … and I `] activate` d `RayTracingWeekend/test` .

Remove the `test` from there. (Open the main project folder directly, to be in the environment of the project)

And add the test-only dependencies to the “extras” section of Project.toml

---

<div class="post-metadata">

**Author:** ![claforte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/claforte/32/19115_2.png) [@claforte](https://discourse.julialang.org/u/claforte)\
**Post date:** [December 19, 2021, 10:09am UTC](https://discourse.julialang.org/t/recommended-vscode-workflow-to-run-a-modules-tests-interactively/73311/4 "2021-12-19T10:09:15Z")

</div>

Thanks, I tried that too (sorry, should have mentioned it) and it made no difference to the two problems I described…

---

<div class="post-metadata">

**Author:** ![claforte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/claforte/32/19115_2.png) [@claforte](https://discourse.julialang.org/u/claforte)\
**Post date:** [December 19, 2021, 10:32am UTC](https://discourse.julialang.org/t/recommended-vscode-workflow-to-run-a-modules-tests-interactively/73311/5 "2021-12-19T10:32:35Z")

</div>

> [@roflmaostc](#):
>
> Regarding the first part’ For testing there is the great [TestEnv](https://github.com/JuliaTesting/TestEnv.jl) package which should at least fix missing dependencies problems. So you activate your general environment of that package and then invoke the TestEnv activate function.

Thanks! I just tried TestEnv, it allows me to activate the module’s test environment, but when I try to run `using RayTracingWeekend` with Shift-Enter I still get the same error message… i.e. I can’t use my own module’s functions in its tests when I run interactively…

---

<div class="post-metadata">

**Author:** ![claforte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/claforte/32/19115_2.png) [@claforte](https://discourse.julialang.org/u/claforte)\
**Post date:** [December 19, 2021, 11:12am UTC](https://discourse.julialang.org/t/recommended-vscode-workflow-to-run-a-modules-tests-interactively/73311/6 "2021-12-19T11:12:07Z")

</div>

It now looks like problem #1 may be a bug specific to the previous version of vscode (and possibly the newer one too - I didn’t try it since it has a different bug ). I tried vscode-insiders 1.64.0 with the Julia-insiders plug-in, and I’m able to run `using RayTracingWeekend` without problem.

As for problem #2… I finally noticed that there’s an issue for that:

[https://github.com/julia-vscode/julia-vscode/issues/1869](https://github.com/julia-vscode/julia-vscode/issues/1869)

My work-around for now is to manually comment-out the `@testset` and its `end`, everytime I want to run the test… annoying and error-prone…
