[erlang-questions] Multiple common_test test case execution with different configs

JD Bothma <>
Thu Mar 21 10:25:09 CET 2013


You could try something like this:

all() -> [ {group, GroupName} || GroupName <- group_names() ].

init_per_group(utf8_this, Config) ->
  [{user, this_user} | Config];
init_per_group(utf8_that, Config) ->
  [{user, that_user} | Config].

You can be more concise with something like

init_epr_group(GroupName = UTF8Case, Config) ->
  [{user, utf_cases_user(UTF8Case)} | Config}].

This isn't ideal when you have groups unrelated to your utf8 cases, but can
be solved :)


On 20 March 2013 20:20, Daniil Churikov <> wrote:

> I use common test framework to check some tricky scenarios.
> Suppose that I wrote test case which intended to check user registration
> process:
>
>     check_user_registration(Config) ->
>         UserSpec = proplists:get_value(user, Config),
>         ok = do_register(UserSpec).
>
> UserSpec contains several fields(name, email, login, password etc.).
> Now I want to check user registration with different UserSpecs, with long
> login,
> with utf8 name or weak password.
>
> The idea is to generate different Config variables with different
> combination
> of such properties and somehow tell CT execute test case with those
> configs:
>
>     all() -> [{check_user_registration, Config1}, ...
> {check_user_registration, ConfigN}].
>
> But I cant figure out how to do this. My first approach was to use groups
> [1] for this.
> They could be generated from Module:groups/0 [2] and allow dynamically
> change number of testcases and/or groups to be executed. Still, their
> definition
> contains order of execution and other useful properties, but not actual
> Config.
>
> [1]
> http://www.erlang.org/doc/apps/common_test/write_test_chapter.html#id71944
> [2] http://www.erlang.org/doc/man/common_test.html#Module:groups-0
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130321/db8ad6c0/attachment.html>


More information about the erlang-questions mailing list