# Running tests with dune without installing

**URL:** <https://discuss.ocaml.org/t/running-tests-with-dune-without-installing/3124>\
**Category:** Learning\
**Created:** [January 4, 2019, 7:44am UTC](https://discuss.ocaml.org/t/running-tests-with-dune-without-installing/3124 "2019-01-04T07:44:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![XVilka](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/xvilka/32/5334_2.png) [@XVilka](https://discuss.ocaml.org/u/XVilka)\
**Post date:** [January 4, 2019, 7:44am UTC](https://discuss.ocaml.org/t/running-tests-with-dune-without-installing/3124/1 "2019-01-04T07:44:26Z")

</div>

For example if we have a directory structure like this:

```auto
pkg1/jbuild
pkg2/jbuild
pkg1_tests/jbuild
pkg2_tests/jbuild
pkg1.opam
pkg2.opam

```

Where `pkg1_tests/jbuild` and `pkg2_tests/jbuild` use `pkg1` and `pkg2` for linking or preprocessing. Is it possible to do `dune runtest` for `pkg1_tests` and `pkg2_tests` without installing `pkg1` and `pkg2` before?  
Sadly I wasn’t able to find any information about this scenario in the tutorial.  
For real world project - see [https://github.com/mirage/ocaml-cstruct](https://github.com/mirage/ocaml-cstruct)  
It can be built with `dune build` - it will build both `cstruct` and `ppx_cstruct`, but it is impossible to run `dune runtest` in `ppx_test` without installing `cstruct` and `ppx_cstruct` first. And you can’t specify something like `dune runtest -p ppx_test` since there is no opam for `ppx_test`. What should I do?

---

<div class="post-metadata">

**Author:** ![Juloo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/juloo/32/881_2.png) [@Juloo](https://discuss.ocaml.org/u/Juloo)\
**Post date:** [January 4, 2019, 9:37am UTC](https://discuss.ocaml.org/t/running-tests-with-dune-without-installing/3124/2 "2019-01-04T09:37:25Z")

</div>

You should run `dune runtest` from the root directory, so dune can see pkg1 and pkg2.  
Dune will try to not build/run something if it is not necessary.  
Try `dune runtest pkg1_tests`
