# Sharing helper function between unit and integration tests

**URL:** <https://users.rust-lang.org/t/sharing-helper-function-between-unit-and-integration-tests/9941>\
**Category:** help\
**Created:** [March 15, 2017, 2:22pm UTC](https://users.rust-lang.org/t/sharing-helper-function-between-unit-and-integration-tests/9941 "2017-03-15T14:22:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![cuviper](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cuviper/32/3156_2.png) [@cuviper](https://users.rust-lang.org/u/cuviper)\
**Post date:** [March 15, 2017, 5:52pm UTC](https://users.rust-lang.org/t/sharing-helper-function-between-unit-and-integration-tests/9941/3 "2017-03-15T17:52:19Z")

</div>

> [@kaj](#):
>
> I hope there is a better way, but one possibility is to put the helper\_function in a separate file and include!() that file from both the test mod in src/lib.rs and from your integration test file(s).

Another way to do the same thing is with `#[path]`, like:

```rust
#[path="../src/helper.rs"]
mod helper;

```

Still not _great_, but slightly cleaner than `include!()` IMO.

---

_[View the full topic](https://users.rust-lang.org/t/sharing-helper-function-between-unit-and-integration-tests/9941)._
