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

[ENHANCEMENT] Friendly test names and descriptions #3945

Merged
merged 1 commit into from
Apr 28, 2015
Merged

[ENHANCEMENT] Friendly test names and descriptions #3945

merged 1 commit into from
Apr 28, 2015

Conversation

eccegordo
Copy link

Added a test-info utility and refactored test blueprints to provide more friendly names and or descriptions.

The test-info utility contains a few methods

humanize -> convert string to humanized form
name -> return a test name with prefix
description - > return a test description with prefix

The prefix includes the test type (Unit or Acceptance) as well as the blueprint type (model, adapter, component, mixin, etc)

The end result is that tests will have better names and descriptions when displayed inside qunit user interface.

Some examples

Unit | Component | x-foo
Unit | Route | foo
Unit | Controller | foo
Acceptance | my cool feature

Added a test-info utility and refactored test blueprints to provide more friendly names and or descriptions.

The test-info utility contains a few methods

humanize -> convert string to humanized form
name -> return a test name with prefix
description - > return a test description with prefix

The prefix includes the test type (Unit or Acceptance) as well as the blueprint type (model, adapter, component, mixin, etc)

The end result is that tests will have better names and descriptions when displayed inside qunit user interface.

Some examples

Unit | Component | x-foo
Unit | Route | foo
Unit | Controller | foo
Acceptance | my cool feature
@stefanpenner
Copy link
Contributor

LGTM – @jgwhite r?

@eccegordo
Copy link
Author

Also, I am thinking that the test-info utility could, in theory, eventually be expanded if we want to support more sophisticated behaviors inside test blueprints.

Not sure what those might be yet but perhaps there are some interesting use cases. Perhaps stuff like dynamically populating the needs array or passing more complicated test setup boilerplate in a reasonably DRY way.

Anyway that is why I called it test-info to make it general purpose.

@jgwhite
Copy link
Contributor

jgwhite commented Apr 22, 2015

@stefanpenner confirm 👍

iojs failure seems unrelated.

@eccegordo
Copy link
Author

Interesting the iojs failures on travis.

Local tests run fine using iojs v1.5.1

@stefanpenner
Copy link
Contributor

@eccegordo re-triggering – we have a race condition which is hopefully just in our tests, that becomes more apparent in iojs. Some weekend, i will dig into it.

@chadhietala
Copy link
Member

For some reason I can not start Appveyor but I would like to get this merged.

stefanpenner added a commit that referenced this pull request Apr 28, 2015
…tions

[ENHANCEMENT] Friendly test names and descriptions
@stefanpenner stefanpenner merged commit d04278c into ember-cli:master Apr 28, 2015
@stefanpenner
Copy link
Contributor

these aren't intermittent windows error, but they are unrelated to this PR.

@eccegordo
Copy link
Author

Woot! Thanks for merging.

ret = testType + SEPARATOR + this.humanize(description);
}
return ret;
}
Copy link
Member

Choose a reason for hiding this comment

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

@eccegordo @stefanpenner I'm wondering why the implementation of name() and description() is completely identical. was that intentional? also it currently seems impossible to generate Unit | Components | x-foo because the dash in x-foo will be removed, so it seems that the documentation does not match the implementation in some cases.

Copy link
Author

@eccegordo eccegordo Apr 13, 2017

Choose a reason for hiding this comment

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

I believe at the time name and description were just two values in the various test files in different places but I was not sure of the distinction myself. They appeared to emit the same content. Might just be some minor inconsistency in the blueprints. Maybe stefan knows better than I what is correct. But yes it was intentional but might not be correct.

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.

None yet

6 participants