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

rebar3 new ct-suite #2067

Open
tsloughter opened this issue May 5, 2019 · 6 comments
Open

rebar3 new ct-suite #2067

tsloughter opened this issue May 5, 2019 · 6 comments
Labels
beginner enhancement new behaviour or additional functionality

Comments

@tsloughter
Copy link
Collaborator

A common test suite template would be useful. Like:

rebar3 new ct-suite modname

Creates the file test/modname_SUITE.erl:

-module(modname_SUITE).

-compile(export_all).

-include_lib("common_test/include/ct.hrl").
-include_lib("stdlib/include/assert.hrl").

all() ->
  [].

init_per_suite(Config) ->
  Config.

end_per_suite...

init_per_group..

end_per_group..

init_per_testcase...

end_per_testcase...
@tsloughter tsloughter added enhancement new behaviour or additional functionality beginner labels May 5, 2019
@max-au
Copy link
Contributor

max-au commented May 9, 2019

Funny enough, I have exactly this template done (did PR just now).

I'd also suggest to add gen_server, supervisor (there is one for "rebar3 new app", but it's worth having it separated), and gen_statem.

@ferd
Copy link
Collaborator

ferd commented Jun 8, 2019

We should figure out what we want to keep between #2070 and #2072

@max-au
Copy link
Contributor

max-au commented Jun 13, 2019

I was waiting for this one - https://github.com/erlang/rebar3/pull/2070/files#r282486325 - to be resolved.

I don't have a strong opinion, except for -export_all controversy. This may trigger "broken window theory" - if code has one warning suppressed, it is quite tempting to suppress more and more, and end up with removing the warning altogether.

@ferd
Copy link
Collaborator

ferd commented Jun 14, 2019

I'll wait for @tsloughter for the comment you mentioned. OTOH for the -export_all I generally like it, but I think it could make sense to use -compile([export_all, nowarn_export_all]) in the template only so that it does not turn off the warning for regular modules, only for the CT test suite we know may export dozens of cases. I don't recall if you found that to be too lax as well (or if it risked causing issues on older OTP versions)

@tsloughter
Copy link
Collaborator Author

I failed to add that feature :(. One of my attempts was https://github.com/erlang/rebar3/pull/2076/files

I also tried using expand_path for the variable substitution.

Kind of annoying, we actually do this in the relx overlays.. All the templating really should be consolidated, it is a mess.

@tsloughter
Copy link
Collaborator Author

But also, the thing I have the strongest opinion on is that export_all is used, hehe. But agree it makes sense to use -compile([export_all, nowarn_export_all]) instead of putting it in the profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner enhancement new behaviour or additional functionality
Projects
None yet
Development

No branches or pull requests

3 participants