# Cannot fetch the app env in common test

**URL:** <https://erlangforums.com/t/cannot-fetch-the-app-env-in-common-test/4293>\
**Category:** Questions / Help\
**Tags:** rebar3, common\_test, application\
**Created:** [December 15, 2024, 7:54am UTC](https://erlangforums.com/t/cannot-fetch-the-app-env-in-common-test/4293 "2024-12-15T07:54:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlotm](https://erlangforums.com/user_avatar/erlangforums.com/carlotm/32/1870_2.png) [@carlotm](https://erlangforums.com/u/carlotm)\
**Post date:** [December 15, 2024, 7:54am UTC](https://erlangforums.com/t/cannot-fetch-the-app-env-in-common-test/4293/1 "2024-12-15T07:54:00Z")

</div>

Hi all,

I would like to use a custom config file for ct.

If I try to display `application:get_all_env(myapp)`, it is however always empty.

I tried specifying the config file in 2 ways:

1. In `rebar.config` as `{ct, [{config, "config/test.config"}]}.`
2. From the cli as `rebar3 ct --config config/test.config`

I made a minimal project so it’s easy to reproduce, if you anyone would help: [GitHub - carlotm/cte](https://github.com/carlotm/cte)

Notes:

1. I start the application in the suite like this: [cte/test/cte\_SUITE.erl at 80ed9ad168464ab052960c0d075aabd2e97ca6b8 · carlotm/cte · GitHub](https://github.com/carlotm/cte/blob/80ed9ad168464ab052960c0d075aabd2e97ca6b8/test/cte_SUITE.erl#L11)
2. What I’m using to check if the env is picked up is erlang display, here: [cte/src/cte\_app.erl at 80ed9ad168464ab052960c0d075aabd2e97ca6b8 · carlotm/cte · GitHub](https://github.com/carlotm/cte/blob/80ed9ad168464ab052960c0d075aabd2e97ca6b8/src/cte_app.erl#L15)

Cheers!

---

<div class="post-metadata">

**Author:** ![dgud](https://erlangforums.com/user_avatar/erlangforums.com/dgud/32/191_2.png) [@dgud](https://erlangforums.com/u/dgud)\
**Post date:** [December 15, 2024, 8:13am UTC](https://erlangforums.com/t/cannot-fetch-the-app-env-in-common-test/4293/2 "2024-12-15T08:13:56Z")

</div>

Have you started your app?

I…e. application:start(myapp). in init\_per\_suite, init\_per\_group or init\_per\_testcase or in the testcase it self.

---

<div class="post-metadata">

**Author:** ![carlotm](https://erlangforums.com/user_avatar/erlangforums.com/carlotm/32/1870_2.png) [@carlotm](https://erlangforums.com/u/carlotm)\
**Post date:** [December 15, 2024, 8:18am UTC](https://erlangforums.com/t/cannot-fetch-the-app-env-in-common-test/4293/3 "2024-12-15T08:18:06Z")

</div>

I am using `{ok, _} = application:ensure_all_started(cte),` in the `init_per_suite` (see Notes 1. in the original post for a link to the specific line)

---

<div class="post-metadata">

**Author:** ![mmin](https://erlangforums.com/user_avatar/erlangforums.com/mmin/32/2193_2.png) [@mmin](https://erlangforums.com/u/mmin)\
**Post date:** [December 15, 2024, 4:01pm UTC](https://erlangforums.com/t/cannot-fetch-the-app-env-in-common-test/4293/4 "2024-12-15T16:01:09Z")

</div>

> [@carlotm](#):
>
> In `rebar.config` as `{ct, [{config, "config/test.config"}]}.`

It should be: `{ct_opts, [{sys_config, ["config/test.config"]}]}`

---

<div class="post-metadata">

**Author:** ![carlotm](https://erlangforums.com/user_avatar/erlangforums.com/carlotm/32/1870_2.png) [@carlotm](https://erlangforums.com/u/carlotm)\
**Post date:** [December 15, 2024, 4:05pm UTC](https://erlangforums.com/t/cannot-fetch-the-app-env-in-common-test/4293/5 "2024-12-15T16:05:14Z")

</div>

Correct! Thanks.

For reference, it’s [documented here](http://rebar3.org/docs/configuration/configuration/#common-test).

Cheers!
