# Test files outside test folder

**URL:** <https://forum.elixirforum.com/t/test-files-outside-test-folder/7846>\
**Category:** Questions\
**Tags:** testing, how-to-question\
**Created:** [August 16, 2017, 11:57am UTC](https://forum.elixirforum.com/t/test-files-outside-test-folder/7846 "2017-08-16T11:57:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericdouglas](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ericdouglas/32/41137_2.png) [@ericdouglas](https://forum.elixirforum.com/u/ericdouglas)\
**Post date:** [August 16, 2017, 11:57am UTC](https://forum.elixirforum.com/t/test-files-outside-test-folder/7846/1 "2017-08-16T11:57:03Z")

</div>

I would like to put test files alongside the actual code/file that will be tested.

Is it possible? If yes, how can I setup this?

Example:

```elixir
lib/kv.ex
lib/kv_test.exs

```

---

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/32/27235_2.png) [@NobbZ](https://forum.elixirforum.com/u/NobbZ)\
**Post date:** [August 16, 2017, 12:07pm UTC](https://forum.elixirforum.com/t/test-files-outside-test-folder/7846/2 "2017-08-16T12:07:29Z")

</div>

Take a look at [mix test — Mix v1.20.2](https://hexdocs.pm/mix/Mix.Tasks.Test.html#module-configuration)

Especially the option test\_path.

---

<div class="post-metadata">

**Author:** ![ericdouglas](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ericdouglas/32/41137_2.png) [@ericdouglas](https://forum.elixirforum.com/u/ericdouglas)\
**Post date:** [August 16, 2017, 12:18pm UTC](https://forum.elixirforum.com/t/test-files-outside-test-folder/7846/3 "2017-08-16T12:18:39Z")

</div>

@NobbZ many thanks!

Just to keep it extremally clear for someone facing the same challenge in the future, what you need to do is:

**1)** Go to the file `mix.exs` and add `test_paths: ["lib"]` in the `project` function.

Example:

```elixir
def project do
  [
    app: :kv,
    version: "0.1.0",
    elixir: "~> 1.5",
    start_permanent: Mix.env == :prod,
    test_paths: ["lib"],
    deps: deps()
  ]
end

```

**2)** Put the `test_helper.exs` file inside the `lib` folder

**3)** Now you can create all your test files inside the `lib` folder 👍
