<div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">You could try something like this:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
all() -> [ {group, GroupName} || GroupName <- group_names() ].</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">init_per_group(utf8_this, Config) -></div>
<div style="font-family:arial,sans-serif;font-size:13px"> [{user, this_user} | Config];</div><div style="font-family:arial,sans-serif;font-size:13px">init_per_group(utf8_that, Config) -></div><div style="font-family:arial,sans-serif;font-size:13px">
[{user, that_user} | Config].</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">You can be more concise with something like</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">init_epr_group(GroupName = UTF8Case, Config) -></div><div style="font-family:arial,sans-serif;font-size:13px"> [{user, utf_cases_user(UTF8Case)} | Config}].</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">This isn't ideal when you have groups unrelated to your utf8 cases, but can be solved :)</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 20 March 2013 20:20, Daniil Churikov <span dir="ltr"><<a href="mailto:ddosia@gmail.com" target="_blank">ddosia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I use common test framework to check some tricky scenarios.<br>Suppose that I wrote test case which intended to check user registration process:<br><br> check_user_registration(Config) -><br> UserSpec = proplists:get_value(user, Config),<br>
ok = do_register(UserSpec).<br><br>UserSpec contains several fields(name, email, login, password etc.).<br>Now I want to check user registration with different UserSpecs, with long login,<br>with utf8 name or weak password.<br>
<br>The idea is to generate different Config variables with different combination<br>of such properties and somehow tell CT execute test case with those configs:<br><br> all() -> [{check_user_registration, Config1}, ... {check_user_registration, ConfigN}].<br>
<br>But I cant figure out how to do this. My first approach was to use groups [1] for this.<br>They could be generated from Module:groups/0 [2] and allow dynamically<br>change number of testcases and/or groups to be executed. Still, their definition<br>
contains order of execution and other useful properties, but not actual Config.<br><br>[1] <a href="http://www.erlang.org/doc/apps/common_test/write_test_chapter.html#id71944" target="_blank">http://www.erlang.org/doc/apps/common_test/write_test_chapter.html#id71944</a><br>
[2] <a href="http://www.erlang.org/doc/man/common_test.html#Module:groups-0" target="_blank">http://www.erlang.org/doc/man/common_test.html#Module:groups-0</a><br><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>