diff options
author | Peter Andersson <[email protected]> | 2011-09-05 19:51:59 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2011-09-23 12:24:55 +0200 |
commit | e91ba727f534553a34c05ad54247a0485e2429ff (patch) | |
tree | 79759dfa3c1d4af4297975ecdcc8d40288a2d507 /lib/common_test/src/ct_framework.erl | |
parent | 6668a91b365b8390d8eb369f7d6c6294711a1fef (diff) | |
download | otp-e91ba727f534553a34c05ad54247a0485e2429ff.tar.gz otp-e91ba727f534553a34c05ad54247a0485e2429ff.tar.bz2 otp-e91ba727f534553a34c05ad54247a0485e2429ff.zip |
Implement support for running suites with test case groups through the debugger
OTP-9518
Diffstat (limited to 'lib/common_test/src/ct_framework.erl')
-rw-r--r-- | lib/common_test/src/ct_framework.erl | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index 29caa27d94..089d5be871 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -24,8 +24,8 @@ -module(ct_framework). --export([init_tc/3, end_tc/3, end_tc/4, get_suite/2, report/2, warn/1]). --export([error_notification/4]). +-export([init_tc/3, end_tc/3, end_tc/4, get_suite/2, get_all_cases/1]). +-export([report/2, warn/1, error_notification/4]). -export([get_logopts/0, format_comment/1, overview_html_header/1]). @@ -781,6 +781,37 @@ get_suite(Mod, Name) -> %%%----------------------------------------------------------------- +get_all_cases(Suite) -> + case get_suite(Suite, all) of + [{?MODULE,error_in_suite,[[{error,_}=Error]]}] -> + Error; + [{?MODULE,error_in_suite,[[Error]]}] -> + {error,Error}; + Tests -> + Cases = get_all_cases1(Suite, Tests), + lists:reverse( + lists:foldl(fun(TC, TCs) -> + case lists:member(TC, TCs) of + true -> TCs; + false -> [TC | TCs] + end + end, [], Cases)) + end. + +get_all_cases1(Suite, [{conf,_Props,_Init,GrTests,_End} | Tests]) -> + get_all_cases1(Suite, GrTests) ++ get_all_cases1(Suite, Tests); + +get_all_cases1(Suite, [Test | Tests]) when is_atom(Test) -> + [{Suite,Test} | get_all_cases1(Suite, Tests)]; + +get_all_cases1(Suite, [Test | Tests]) -> + [Test | get_all_cases1(Suite, Tests)]; + +get_all_cases1(_, []) -> + []. + +%%%----------------------------------------------------------------- + find_groups(Mod, Name, TCs, GroupDefs) -> Found = find(Mod, Name, TCs, GroupDefs, [], GroupDefs, false), trim(Found). |