Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common Test SUITE template #2070

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions priv/templates/ct_suite.erl
Original file line number Diff line number Diff line change
@@ -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).

6 changes: 6 additions & 0 deletions priv/templates/ct_suite.template
Original file line number Diff line number Diff line change
@@ -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"}.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the problems we have overall with the templater. It only works from the current working directory, and we get a bit of a funny thing for umbrella releases where the tests might go in appname/test/{{name}}_SUITE.erl.

Can you quickly check if we can allow {{dir}}/{{name}}_SUITE.erl as a path but with dir configurable with a default to test?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also going to add a feature for getting the name of the parent directory to use. I need that to complete the init-release template so it has a good default name. Could use the same for this.