# Error on running tests for a self-written package

**URL:** <https://discourse.julialang.org/t/error-on-running-tests-for-a-self-written-package/30705>\
**Category:** New to Julia\
**Created:** [November 4, 2019, 5:41pm UTC](https://discourse.julialang.org/t/error-on-running-tests-for-a-self-written-package/30705 "2019-11-04T17:41:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterlane](https://avatars.discourse-cdn.com/v4/letter/p/9dc877/32.png) [@peterlane](https://discourse.julialang.org/u/peterlane)\
**Post date:** [November 4, 2019, 5:41pm UTC](https://discourse.julialang.org/t/error-on-running-tests-for-a-self-written-package/30705/1 "2019-11-04T17:41:16Z")

</div>

I have written a package along with some unit tests, which I would like to be able to run once the package is added to Julia. But I get an error:

```julia
pkg> add gitlink-to-PackageName
pkg> test PackageName
ERROR: LoadError: ArgumentError: Package Test not found in current path:
- Run `import Pkg; Pkg.add("Test")` to install the Test package.

```

I do: pkg\> add Test  
which adds Test to the package list, but still ‘test PackageName’ fails with the same error.

I am using Julia 1.2.0. I can run tests on other packages I have installed.

Questions:

1. What step am I missing, so the ‘Test’ package I load in ‘pkg’ is available to my package’s ‘runtests’?
2. Why does ‘Test’ need installing separately, if it’s in the stdlib?

I am following the (possibly outdated) page: [Finalizing Your Julia Package: Documentation, Testing, Coverage, and Publishing - Stochastic Lifestyle](http://www.stochasticlifestyle.com/finalizing-julia-package-documentation-testing-coverage-publishing/)

I had to replace ‘using Base.Test’ with ‘using Test’, but apart from that,

- PackageName/src has my code
- PackageName/test has ‘runtests.jl’

$ julia test/runtests.jl runs and shows all tests passing.

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [November 4, 2019, 6:15pm UTC](https://discourse.julialang.org/t/error-on-running-tests-for-a-self-written-package/30705/2 "2019-11-04T18:15:50Z")

</div>

```julia
cd("package dir")
] activate .
] add Test
] test packageName

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 4, 2019, 6:27pm UTC](https://discourse.julialang.org/t/error-on-running-tests-for-a-self-written-package/30705/3 "2019-11-04T18:27:36Z")

</div>

What happens when you do `using Test`?

---

<div class="post-metadata">

**Author:** ![peterlane](https://avatars.discourse-cdn.com/v4/letter/p/9dc877/32.png) [@peterlane](https://discourse.julialang.org/u/peterlane)\
**Post date:** [November 4, 2019, 10:13pm UTC](https://discourse.julialang.org/t/error-on-running-tests-for-a-self-written-package/30705/4 "2019-11-04T22:13:00Z")

</div>

There doesn’t seem to be a problem with Test itself. I have a ‘runtests.jl’ file, and that runs fine, with all tests passing.

At the REPL:

```julia
julia> using Test

julia> @test 1 == 1
Test Passed

```

---

<div class="post-metadata">

**Author:** ![peterlane](https://avatars.discourse-cdn.com/v4/letter/p/9dc877/32.png) [@peterlane](https://discourse.julialang.org/u/peterlane)\
**Post date:** [November 4, 2019, 10:23pm UTC](https://discourse.julialang.org/t/error-on-running-tests-for-a-self-written-package/30705/5 "2019-11-04T22:23:14Z")

</div>

> [@Tero\_Frondelius](#):
>
> ```julia
> cd("package dir")
> ] activate .
> ] add Test
> ] test packageName
> 
> ```

Ah, thankyou! That worked.

Those commands created a Manifest.toml and added to my Profile.toml. Once those were included in the git repository, the package manager could successfully run the tests.
