From b81aa638404947b7fd69b2558234cce8847c40c0 Mon Sep 17 00:00:00 2001 From: Maxim Fedorov Date: Wed, 8 May 2019 21:47:59 -0700 Subject: [PATCH] Common Test SUITE template Contains boilerplate code and a few hints how Common Tests are to be used --- priv/templates/ct_suite.erl | 53 ++++++++++++++++++++++++++++++++ priv/templates/ct_suite.template | 6 ++++ 2 files changed, 59 insertions(+) create mode 100644 priv/templates/ct_suite.erl create mode 100644 priv/templates/ct_suite.template diff --git a/priv/templates/ct_suite.erl b/priv/templates/ct_suite.erl new file mode 100644 index 000000000..af0bafbdf --- /dev/null +++ b/priv/templates/ct_suite.erl @@ -0,0 +1,53 @@ +%%%------------------------------------------------------------------- +%% @copyright (c) {{copyright_year}} {{author_name}} +%%%------------------------------------------------------------------- + +-module({{name}}_SUITE). +-author("{{author_email}}"). + +-include_lib("common_test/include/ct.hrl"). + +%% Enables ?assert() for readable output +-include_lib("stdlib/include/assert.hrl"). + +-compile(nowarn_export_all). +-compile(export_all). + +%%%------------------------------------------------------------------- +%% Test server callbacks + +suite() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, _Config) -> + ok. + +init_per_testcase(_TestCase, Config) -> + Config. + +end_per_testcase(_TestCase, _Config) -> + ok. + +groups() -> + []. + +all() -> + [basic]. + +%%%------------------------------------------------------------------- +%% Test cases +basic() -> + [{doc, "Tests basic functionality"}]. + +basic(_Config) -> + ?assert(true). + diff --git a/priv/templates/ct_suite.template b/priv/templates/ct_suite.template new file mode 100644 index 000000000..93ea94afb --- /dev/null +++ b/priv/templates/ct_suite.template @@ -0,0 +1,6 @@ +{description, "Common Test suite"}. +{variables, [ + {name, "suite", "Name of the suite, prepended to the standard _SUITE suffix"} +]}. +{dir, "test"}. +{template, "ct_suite.erl", "test/{{name}}_SUITE.erl"}.