-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Test Directories #575
Test Directories #575
Conversation
Other than wondering if tests/rendering or tests/components is better, I think we should do this. |
I think |
To me |
I like |
For the record I don’t have a strong preference on the names other than being consistent. I would lean towards making them consistent before changing them again though, but also fine with a revisit. I’m guessing someone will need to make an executive decision at some point though. |
I'm happy with those changes, we discussed it last year and calling a rendering test an integration tests caused confusion (especially since docs and generators are out of sync). Basically, FWIW: components/my-component/
- component.ts
- template.hbs
- story.js // demo
- story.mdx // docs
- rendering-test.js // test declarative API
- unit-test.js // test imperative API
- integration-test.js // tests with backend/REST API integration Using pods here to demonstrate, this is how I'd see the test landscape for components, use the test-files required for your component. |
Rendering tests can also be helpers. |
- tests/unit/utils -> tests/unit | ||
- tests/unit/controllers -> tests/container/controllers | ||
- tests/unit/routes -> tests/container/routes | ||
- tests/unit/services -> tests/container/services |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These list does not include all directories, in which tests are created by existing blueprints. All folders used by Ember Data to place tests in are missing:
- tests/unit/adapters
- tests/unit/models
- tests/unit/serializers
- tests/unit/transforms
Also the tests created for components and helpers if --unit
flag is parsed are missing:
- tests/unit/components
- tests/unit/helpers
Same it true for not that popular features like mixins and (instance) initializers.
The RFC should also say what should happen to these. Not sure how the RFC should handle folders in tests
that are used by addons not being part of the default blueprint. I guess they should not be touched but this should be stated explicitly in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't attempting to solve for Ember Data unit tests! Those generators can keep doing whatever they want IMO. @runspired or someone else from ED, do you want to expand this RFC to address those as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I'm very much in favor of this direction. However, I strongly dislike "container" as a name here (I know that you didn't make up this term, and are just using what is currently commonly used). The "container" is (and always has been) a completely private API. Adding a directory structure that mentions a private thing seems very bizarre.
I regret a bit the names we landed on in #268, and perhaps this is good time to discuss those names. In the new testing system, all tests have an application (in fact if you look at the setup difference between setupApplicationTest
and setupTest
you will see that there is basically nothing done in setupApplicationTest
see here).
I think what we should have done was:
setupApplicationTest
will continue to be used in routing related tests (those that usevisit
)setupTest
->setupApplicationTest
- as mentioned above,setupApplicationTest
actually doesn't do anything more thansetupTest
anyways, and it is perfectly valid to usesetupTest
+visit
in the same test.setupRenderingTest
- no changes.
Like I mentioned above, all of them use a full application and it would behoove us to keep that in mind.
No it hasn't. Do I need to bring this up again? |
@rwjblue I'm fine with a totally new structure, but that increases the scope of this RFC to update all the docs again as well. |
Agree to disagree 😸
Only if you want to be wrong again 😜... Show me where in that file the word "public" occurs? |
I am a big fan of this sort of cleanup. However, I would advocate for making our primary organization structure for the In the pre-RFC268 world, the what and the how were tightly coupled via the So since they are decoupled, I don't think we should keep them coupled in the directory structure -- I don't think we should be deciding that component tests are rendering tests or service tests are unit or container tests or whatever. Sure, the blueprints will give you a default So here's my proposal -- get rid of the intermediate
let's do
The I think this proposal leaves two questions unresolved:
For (1), I think I'd lean towards leaving it at (2) is a kinda disappointing sticking point, right when I thought my idea was all slick and clean 😥 My two ideas are to name it something like |
I am very in favor of this change. I am going to post in my issue I opened up having the same thoughts. Reading through the ember guides https://guides.emberjs.com/release/testing/testing-components/ the use of new language like In the current state of trying to connect that language to the supported flags and folder hierarchy it would be greatly helpful to migrate the following words across the board. acceptance -> application This might seem pedantic but the language we use to describe the types of tests we are writing is extremely helpful when it comes to how people write their tests. Given the following example:
It not obvious to engineers when they onboard that the word integration means your tests are testing the integration between your component and inputs of that component. If this would be flipped to be rendering;
It is extremely pointed that your component is being tested in the context of the inputs it is given and how it is rendered. This similarly could be applied to acceptance as the word acceptance in the context of tests is ambiguous. Everything is considered an acceptance test as you would want them to pass in order for changes to be accepted. If this was changed to be application tests it would be focused on how your application is tested in the context of outside factors like, but not only; api changes, logged in users, errors, etc. |
- tests/acceptance -> tests/application | ||
- tests/integration > tests/rendering | ||
- tests/unit/utils -> tests/unit | ||
- tests/unit/controllers -> tests/container/controllers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a reason these are called container now? I think unit is generally a good way to look at testing this at the interface level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From his comments above, it does seem like #268 is where they came up:
However, I strongly dislike "container" as a name here
I regret a bit the names we landed on in #268, and perhaps this is good time to discuss those names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through #268 I can't seem to find the introduction of it in the doc or comments.
FWIW I fully agree with @bendemboski, that the paths should reflect what is being tested, not how it is being tested. It is absolutely valid to have a test file for something and use e.g. I also agree with @rwjblue that we should probably merge the various The suggestion above would also make it massively easier to wrap our test setup helpers with custom setup code, since only a single helper would need to be wrapped, instead of three separate ones. |
Combining all the |
Thanks all for the comments. There are a lot of good suggestions here and my reading is that this RFC as proposed is not worth the change on its own and that the whole testing setup should be revisited. If that's the consensus, can we move this to FCP to close? |
so what's the outcome here?
|
Moving to FCP to close as requested by the author! :) |
The main reason I asked for this to FCP to Close is because I don’t know how to move forward and don’t want it to remain indefinitely open. If anyone has thoughts on a way forward with the ideas as proposed, I’m happy to set aside some time, edit the specifics, and add coauthors. |
rendered