# Running tests in package?

**URL:** <https://discourse.julialang.org/t/running-tests-in-package/102354>\
**Category:** New to Julia\
**Created:** [August 1, 2023, 2:08pm UTC](https://discourse.julialang.org/t/running-tests-in-package/102354 "2023-08-01T14:08:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [August 1, 2023, 2:08pm UTC](https://discourse.julialang.org/t/running-tests-in-package/102354/1 "2023-08-01T14:08:13Z")

</div>

I have a package, say `Neet`. (I made it with `] generate Neet`.) It is a simple package, and `src/Neet.jl` contains only:

```julia
module Neet
export is_great
is_great() = true
end

```

I navigate to the `./Neet` folder and create another directory: `test`.  
I create a file in there named `runtests.jl`, and inside of it:

```julia
using Neet
using Test

@test is_great()

```

How do I run the test from the REPL? `Base.runtests()`?  
I did try this, but it appears that it runs all of the Julia tests … I just want the tests in my package. Maybe I needed to export something, I’m still sort of shaky on packages.

---

<div class="post-metadata">

**Author:** ![BatyLeo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/batyleo/32/35017_2.png) [@BatyLeo](https://discourse.julialang.org/u/BatyLeo)\
**Post date:** [August 1, 2023, 2:32pm UTC](https://discourse.julialang.org/t/running-tests-in-package/102354/2 "2023-08-01T14:32:20Z")

</div>

You can use the `Pkg.test` method or directly use `] test`.

---

<div class="post-metadata">

**Author:** ![brianguenter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brianguenter/32/29519_2.png) [@brianguenter](https://discourse.julialang.org/u/brianguenter)\
**Post date:** [August 1, 2023, 2:49pm UTC](https://discourse.julialang.org/t/running-tests-in-package/102354/3 "2023-08-01T14:49:25Z")

</div>

If you are using VSCode as your IDE you can use the [TestItem](https://github.com/julia-vscode/TestItemRunner.jl) runner to write and execute tests. It’s very convenient and fast to run tests this way because it caches the test environment. The tests are listed in a menu in VSCode which allows you to easily choose which tests you want to run.

I used to run tests using `] test` but because this reloads the test environment each time it is much slower.
