From 0c640f2de05c1a540d4b398de0f1891dfad29cc3 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 12 Oct 2010 11:02:18 +0200 Subject: Update odbc tests to conform with common_test standard --- lib/odbc/test/odbc.spec | 34 +++++++++++---- lib/odbc/test/odbc_connect_SUITE.erl | 41 +++++++++-------- lib/odbc/test/odbc_data_type_SUITE.erl | 80 +++++++++++++++++----------------- lib/odbc/test/odbc_query_SUITE.erl | 76 +++++++++++++++++--------------- lib/odbc/test/odbc_start_SUITE.erl | 24 ++++++---- 5 files changed, 146 insertions(+), 109 deletions(-) diff --git a/lib/odbc/test/odbc.spec b/lib/odbc/test/odbc.spec index acba9f8d98..2151406901 100644 --- a/lib/odbc/test/odbc.spec +++ b/lib/odbc/test/odbc.spec @@ -1,9 +1,25 @@ -{topcase, {dir, "../odbc_test"}}. -{skip, {odbc_data_type_SUITE, varchar_upper_limit, "Known bug in database"}}. -{skip, {odbc_data_type_SUITE, text_upper_limit, "Consumes too much resources"}}. -{skip, {odbc_data_type_SUITE, bit_true , "Not supported by driver"}}. -{skip, {odbc_data_type_SUITE, bit_false, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_select_result_sets,"Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_mix_result_sets, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_result_sets_error, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, param_insert_tiny_int, "Not supported by driver"}}. \ No newline at end of file +{suites,"odbc_test",all}. +{skip_cases,"odbc_test",odbc_data_type_SUITE, + [varchar_upper_limit], + "Known bug in database"}. +{skip_cases,"odbc_test",odbc_data_type_SUITE, + [text_upper_limit], + "Consumes too much resources"}. +{skip_cases,"odbc_test",odbc_data_type_SUITE, + [bit_true], + "Not supported by driver"}. +{skip_cases,"odbc_test",odbc_data_type_SUITE, + [bit_false], + "Not supported by driver"}. +{skip_cases,"odbc_test",odbc_query_SUITE, + [multiple_select_result_sets], + "Not supported by driver"}. +{skip_cases,"odbc_test",odbc_query_SUITE, + [multiple_mix_result_sets], + "Not supported by driver"}. +{skip_cases,"odbc_test",odbc_query_SUITE, + [multiple_result_sets_error], + "Not supported by driver"}. +{skip_cases,"odbc_test",odbc_query_SUITE, + [param_insert_tiny_int], + "Not supported by driver"}. diff --git a/lib/odbc/test/odbc_connect_SUITE.erl b/lib/odbc/test/odbc_connect_SUITE.erl index 093b675fd5..3854e5e144 100644 --- a/lib/odbc/test/odbc_connect_SUITE.erl +++ b/lib/odbc/test/odbc_connect_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -41,17 +41,29 @@ %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(suite) -> - case odbc_test_lib:odbc_check() of - ok -> - [not_exist_db, commit, rollback, not_explicit_commit, - no_c_node, port_dies, control_process_dies, client_dies, - connect_timeout, timeout, many_timeouts, timeout_reset, - disconnect_on_timeout, connection_closed, - disable_scrollable_cursors, return_rows_as_lists, api_missuse]; - Other -> - {skip, Other} - end. +all() -> +case odbc_test_lib:odbc_check() of + ok -> + [not_exist_db, commit, rollback, not_explicit_commit, + no_c_node, port_dies, control_process_dies, + {group, client_dies}, connect_timeout, timeout, + many_timeouts, timeout_reset, disconnect_on_timeout, + connection_closed, disable_scrollable_cursors, + return_rows_as_lists, api_missuse]; + Other -> {skip, Other} +end. + +groups() -> + [{client_dies, [], + [client_dies_normal, client_dies_timeout, + client_dies_error]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config @@ -281,11 +293,6 @@ control_process_dies(_Config) -> ok. %%------------------------------------------------------------------------- -client_dies(doc) -> - ["Test that the odbc process is terminated when the client process " - "dies"]; -client_dies(suite) -> - [client_dies_normal, client_dies_timeout, client_dies_error]. %%------------------------------------------------------------------------- client_dies_normal(doc) -> diff --git a/lib/odbc/test/odbc_data_type_SUITE.erl b/lib/odbc/test/odbc_data_type_SUITE.erl index f0e35edbb2..d4c133fb8b 100644 --- a/lib/odbc/test/odbc_data_type_SUITE.erl +++ b/lib/odbc/test/odbc_data_type_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("stdlib/include/ms_transform.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -39,13 +39,46 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Tests data types"]; -all(suite) -> - case odbc_test_lib:odbc_check() of - ok -> [char, int, floats, dec_and_num, timestamp]; - Other -> {skip,Other} - end. +all() -> +case odbc_test_lib:odbc_check() of + ok -> + [{group, char}, {group, int}, {group, floats}, + {group, dec_and_num}, timestamp]; + Other -> {skip, Other} +end. + +groups() -> + [{char, [], + [char_fixed_lower_limit, char_fixed_upper_limit, + char_fixed_padding, varchar_lower_limit, + varchar_upper_limit, varchar_no_padding, + text_lower_limit, text_upper_limit, unicode]}, + {binary_char, [], + [binary_char_fixed_lower_limit, + binary_char_fixed_upper_limit, + binary_char_fixed_padding, binary_varchar_lower_limit, + binary_varchar_upper_limit, binary_varchar_no_padding, + binary_text_lower_limit, binary_text_upper_limit, + unicode]}, + {int, [], + [tiny_int_lower_limit, tiny_int_upper_limit, + small_int_lower_limit, small_int_upper_limit, + int_lower_limit, int_upper_limit, big_int_lower_limit, + big_int_upper_limit, bit_false, bit_true]}, + {floats, [], + [float_lower_limit, float_upper_limit, float_zero, + real_zero]}, + {dec_and_num, [], + [dec_long, dec_double, dec_bignum, num_long, num_double, + num_bignum]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config @@ -121,14 +154,6 @@ end_per_testcase(_TestCase, Config) -> %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -char(doc) -> - ["Tests char data types"]; - -char(suite) -> - [char_fixed_lower_limit, char_fixed_upper_limit, - char_fixed_padding, varchar_lower_limit, varchar_upper_limit, - varchar_no_padding, text_lower_limit, text_upper_limit, unicode - ]. char_fixed_lower_limit(doc) -> ["Tests fixed length char data type lower boundaries."]; @@ -421,14 +446,6 @@ text_upper_limit(Config) when is_list(Config) -> %% ok. %%------------------------------------------------------------------------- -binary_char(doc) -> - ["Tests char data types returned as erlang binaries"]; - -binary_char(suite) -> - [binary_char_fixed_lower_limit, binary_char_fixed_upper_limit, - binary_char_fixed_padding, binary_varchar_lower_limit, binary_varchar_upper_limit, - binary_varchar_no_padding, binary_text_lower_limit, binary_text_upper_limit, unicode - ]. binary_char_fixed_lower_limit(doc) -> ["Tests fixed length char data type lower boundaries."]; @@ -723,13 +740,6 @@ binary_text_upper_limit(Config) when is_list(Config) -> %%------------------------------------------------------------------------- -int(doc) -> - ["Tests integer data types"]; - -int(suite) -> - [tiny_int_lower_limit, tiny_int_upper_limit, small_int_lower_limit, - small_int_upper_limit, int_lower_limit, int_upper_limit, - big_int_lower_limit, big_int_upper_limit, bit_false, bit_true]. %%------------------------------------------------------------------------- @@ -1050,10 +1060,6 @@ bit_true(Config) when is_list(Config) -> %%------------------------------------------------------------------------- -floats(doc) -> - ["Test the datatype float."]; -floats(suite) -> - [float_lower_limit, float_upper_limit, float_zero, real_zero]. %%------------------------------------------------------------------------- float_lower_limit(doc) -> @@ -1181,10 +1187,6 @@ real_zero(Config) when is_list(Config) -> ok end. %%------------------------------------------------------------------------- -dec_and_num(doc) -> - ["Tests decimal and numeric datatypes."]; -dec_and_num(suite) -> - [dec_long, dec_double, dec_bignum, num_long, num_double, num_bignum]. %%------------------------------------------------------------------------ dec_long(doc) -> [""]; diff --git a/lib/odbc/test/odbc_query_SUITE.erl b/lib/odbc/test/odbc_query_SUITE.erl index 96a3e3fa80..fd04125dbe 100644 --- a/lib/odbc/test/odbc_query_SUITE.erl +++ b/lib/odbc/test/odbc_query_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -38,20 +38,45 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Tests SQL queries"]; -all(suite) -> - case odbc_test_lib:odbc_check() of - ok -> - [sql_query, first, last, next, prev, select_count,select_next, - select_relative, select_absolute, create_table_twice, - delete_table_twice, duplicate_key, not_connection_owner, - no_result_set, query_error, multiple_select_result_sets, - multiple_mix_result_sets, multiple_result_sets_error, - parameterized_queries, describe_table, - delete_nonexisting_row]; - Other -> {skip, Other} - end. +all() -> +case odbc_test_lib:odbc_check() of + ok -> + [sql_query, first, last, next, prev, select_count, + select_next, select_relative, select_absolute, + create_table_twice, delete_table_twice, duplicate_key, + not_connection_owner, no_result_set, query_error, + multiple_select_result_sets, multiple_mix_result_sets, + multiple_result_sets_error, + {group, parameterized_queries}, {group, describe_table}, + delete_nonexisting_row]; + Other -> {skip, Other} +end. + +groups() -> + [{parameterized_queries, [], + [{group, param_integers}, param_insert_decimal, + param_insert_numeric, {group, param_insert_string}, + param_insert_float, param_insert_real, + param_insert_double, param_insert_mix, param_update, + param_delete, param_select]}, + {param_integers, [], + [param_insert_tiny_int, param_insert_small_int, + param_insert_int, param_insert_integer]}, + {param_insert_string, [], + [param_insert_char, param_insert_character, + param_insert_char_varying, + param_insert_character_varying]}, + {describe_table, [], + [describe_integer, describe_string, describe_floating, + describe_dec_num, describe_no_such_table]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- @@ -636,19 +661,8 @@ multiple_result_sets_error(Config) when is_list(Config) -> end. %%------------------------------------------------------------------------- -parameterized_queries(suite) -> - [param_integers, - param_insert_decimal, param_insert_numeric, - param_insert_string, - param_insert_float, param_insert_real, param_insert_double, - param_insert_mix, param_update, param_delete, param_select]. %%------------------------------------------------------------------------- -param_integers(doc)-> - ["Test insertion of integers by parameterized queries."]; -param_integers(suite) -> - [param_insert_tiny_int, - param_insert_small_int, param_insert_int, param_insert_integer]. %%------------------------------------------------------------------------- param_insert_tiny_int(doc)-> ["Test insertion of tiny ints by parameterized queries."]; @@ -885,11 +899,6 @@ param_insert_numeric(Config) when is_list(Config) -> ok. %%------------------------------------------------------------------------- -param_insert_string(doc) -> - ["Test insertion of strings by parameterized queries."]; -param_insert_string(suite) -> - [param_insert_char, param_insert_character, param_insert_char_varying, - param_insert_character_varying]. %%------------------------------------------------------------------------- param_insert_char(doc)-> @@ -1314,11 +1323,6 @@ param_select(Config) when is_list(Config) -> ok. %%------------------------------------------------------------------------- -describe_table(doc) -> - ["Test describe_table/[2,3]"]; -describe_table(suite) -> - [describe_integer, describe_string, describe_floating, describe_dec_num, - describe_no_such_table]. %%------------------------------------------------------------------------- describe_integer(doc) -> diff --git a/lib/odbc/test/odbc_start_SUITE.erl b/lib/odbc/test/odbc_start_SUITE.erl index 07cda38c04..168e5452a5 100644 --- a/lib/odbc/test/odbc_start_SUITE.erl +++ b/lib/odbc/test/odbc_start_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -98,14 +98,22 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test start/stop of odbc"]; +all() -> +case odbc_test_lib:odbc_check() of + ok -> [start]; + Other -> {skip, Other} +end. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - case odbc_test_lib:odbc_check() of - ok -> [start]; - Other -> {skip, Other} - end. + %% Test cases starts here. %%-------------------------------------------------------------------- -- cgit v1.2.3