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

Use user-defined test name in report #47

Merged
merged 5 commits into from
Aug 26, 2016
Merged

Conversation

erlanger
Copy link

ltest-scr

  • Shows the user-defined "Name" in reports
  • Name is specified with eunit format (tuple "Name" ......)
  • Works with fixtures and deftestcase
  • This is better than simply repeating the fixture function name
    for every test
  • Does not work for plain deftest because of an eunit bug which
    does not send the name to the listener for plain tests

* Shows the user-defined "Name" in reports
* Name is specified with eunit format (tuple "Name" ...<test>...)
* Works with fixtures and deftestcase
* This is better than simply repeating the fixture function name
  for every test
* Does not work for plain deftest because of an eunit bug which
  does not send the name to the listener for plain tests
'true
'false))
((t) (when (is_list t))
(if (andalso (== 'tuple (hd t))
Copy link
Member

Choose a reason for hiding this comment

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

Please remove the unnecessary parent if form.

Copy link
Author

@erlanger erlanger Aug 25, 2016

Choose a reason for hiding this comment

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

@yurrriq do you mean the printable_list(...) test? It is needed to differentiante from tuples like
{spawn, Tests} or {timeout, Tests} etc.

@yurrriq
Copy link
Member

yurrriq commented Aug 24, 2016

Standalone comments (i.e. not inline with code) should start with ;; instead of ;. Other than that and my other comments, this looks good to me. Thanks for getting it sorted.

N.B. I don't have merge permissions, but @oubiwann does and maybe @rvirding.

@yurrriq
Copy link
Member

yurrriq commented Aug 25, 2016

io_lib:printable_list/1 already returns a boolean, so there's no need to wrap it in (if ...).

@yurrriq
Copy link
Member

yurrriq commented Aug 25, 2016

You can think of a defun body as having an implicit progn so it's unnecessary.

@yurrriq
Copy link
Member

yurrriq commented Aug 25, 2016

LGTM /cc @oubiwann

@oubiwann
Copy link
Member

oubiwann commented Aug 26, 2016

This looks very cool -- thanks for working on this feature!

I have some thoughts/requests for clarification:

  1. this feature should be optional -- if users don't want to use it, they should have access to the previous behaviour (this may be the case? I haven't dug into the code to see, just looking at diff and running the tests locally off your branch)

  2. Given point 1, the old tests should not be replaced, but rather added to.

If this change set keeps the old behaviour too, could you address point 2?

Looking forward to merging this!

@erlanger
Copy link
Author

It is not an additional feature really, it simply honors the eunit behaviour which was being ignored before whenever you had (tuple "Title" Tests}.... to summarize:

  • behavior before: ignore named tuples (but eunit honors them in a fixture)
  • behavior w/patch: use name only if you have a named tuple, the rest continues to be the same.
    so the user already has an option not to use the feature (simply don't use named tuples in a fixture).

I can keep the old tests and add new ones for the patch.

What do you think?

@yurrriq
Copy link
Member

yurrriq commented Aug 26, 2016

👍 for keeping the old tests and adding new ones. I think point 1 is already addressed.

@oubiwann
Copy link
Member

@erlanger Fantastic -- thanks for sharing more details.

+1 for the test updates -- that should do it (ah, as I typed this, it seems that a new change is being processed by Travis, so you may have just done that ...)

@erlanger
Copy link
Author

hehe, I was pushing the code as you were typing :)

@oubiwann
Copy link
Member

oubiwann commented Aug 26, 2016

You may have already noted this and be debugging it, but it seems that the fixtures tests (ltest-fixture-tests) aren't running right now (on my laptop there should be 150+ tests, but right now only 146 are getting run).

You might not have seen this since there is currently some missing error/state checking in ltest ... but running rebar3 eunit will err out, making the issue above more obvious.

Incidentally, I think I've got a ticket open for this somewhere ... I'll look it up.

Update: Well, I couldn't find the old ticket (maybe it never got created?) so I created a new one: #49.

@erlanger
Copy link
Author

Just posted a fix, it was a missing comma when I restored the old tests.

@oubiwann
Copy link
Member

Sweet, thanks!

@oubiwann oubiwann merged commit 45649ac into lfex:master Aug 26, 2016
oubiwann added a commit that referenced this pull request Oct 25, 2016
Use user-defined test name in report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants