[erlang-questions] CT and test.config

Peter Andersson peppe@REDACTED
Thu Apr 23 16:05:10 CEST 2015


True, if you want the same config file as input to both, you need the
"userconfig" feature in Common Test:

http://www.erlang.org/doc/apps/common_test/config_file_chapter.html#id79185
http://www.erlang.org/doc/man/ct_run.html
http://www.erlang.org/doc/man/ct.html#run_test-1

  /Peter


On 2015-04-23 15:56, Roberto Ostinelli wrote:
> Unfortunately that doesn't work.
>
> `test.config` for application needs to be a file which encloses a list
> of Applications, i.e. [{App1, [App1Config]}, {App2, [App2Config]}].
> `test.config` for CT needs to be a file which has individual entries
> *not* enclosed in a list, i.e. {App1, [App1Config]}. {App2, [App2Config]}.
>
> On Thu, Apr 23, 2015 at 3:50 PM, Peter Andersson <peppe@REDACTED
> <mailto:peppe@REDACTED>> wrote:
>
>
>     Well, if you want the same config file as input to both your
>     application and to CT:
>
>     ct_run -config test.config -erl_args -config test.config
>
>       /Peter
>
>
>     On 2015-04-23 15:24, Roberto Ostinelli wrote:
>>     Thank you Loïc, this works (i.e. `myapp` now starts) but now I'm
>>     unable to read this config file in `myapp_SUITE.erl`.
>>
>>     `application:get_env(myapp, mykey)` and `ct:get_config({myapp,
>>     mykey})` both return `undefined`.
>>
>>     On Thu, Apr 23, 2015 at 1:53 PM, Loïc Hoguin <essen@REDACTED
>>     <mailto:essen@REDACTED>> wrote:
>>
>>         ct_run -erl_args -config test.config
>>
>>
>>         On 04/23/2015 02:41 PM, Roberto Ostinelli wrote:
>>
>>             All,
>>             I've got an app `myapp` which uses a standard
>>             `sys.config` file.
>>             I'd like to test it using Common Tests, with a test
>>             configuration file.
>>
>>             I'm passing the variable `-config test.config` to ct_run.
>>
>>             However, when I start my app from the Common Test suite
>>             `myapp_SUITE.erl` then the app fails to start because
>>             inside the app
>>             `application:get_env(myapp, mykey)` returns `undefined`.
>>             I can, however,
>>             read this variable with `ct:get_config({myapp, mykey})`.
>>
>>             How am I supposed to use a custom `test.config` file that
>>             is loaded in
>>             ct_run *and* read by the app itself?
>>
>>             I've spent almost a day on this and I'm honestly 5
>>             minutes away from
>>             dropping all this in the dustbin and using an external
>>             test tool
>>             instead. Please help me stick to Erlang. :)
>>
>>             r.
>>
>>
>>
>>
>>
>>             _______________________________________________
>>             erlang-questions mailing list
>>             erlang-questions@REDACTED
>>             <mailto:erlang-questions@REDACTED>
>>             http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>>         -- 
>>         Loïc Hoguin
>>         http://ninenines.eu
>>
>>
>>
>>
>>     _______________________________________________
>>     erlang-questions mailing list
>>     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>>     http://erlang.org/mailman/listinfo/erlang-questions
>
>
>     _______________________________________________
>     erlang-questions mailing list
>     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>     http://erlang.org/mailman/listinfo/erlang-questions
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150423/144e0e25/attachment.htm>


More information about the erlang-questions mailing list