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

"lb4 controller" should prepare test infrastructure #885

Closed
bajtos opened this issue Jan 22, 2018 · 4 comments
Closed

"lb4 controller" should prepare test infrastructure #885

bajtos opened this issue Jan 22, 2018 · 4 comments
Labels
CLI developer-experience Issues affecting ease of use and overall experience of LB users feature help wanted

Comments

@bajtos
Copy link
Member

bajtos commented Jan 22, 2018

This is a follow-up for #727, which added lb4 controller command that scaffolds a new CRUD controller, but does not help the user with writing the tests as we recommend in our Best Practices.

Cross-posting comment by @bajtos:

To make it easier for our users to follow the best practices and always write automated tests for their production code, lb4 controller should scaffold unit/integration/acceptance tests for the user too.

Generated tests are usually not very useful, because they are not written in test-first/test-driven style, so there is no need to generate an extensive test suite, but I think we should include at least few basic tests that will make it easier for our users to follow the best practices outlined in our docs:

The generated code should follow the general advices:

For example, I see a lot of value in an integration test file generated for me, one that contains database setup and test-data-builders that I can use straight away in new tests, instead of having to copy blocks of code from the docs for my test setup.

@bajtos bajtos added developer-experience Issues affecting ease of use and overall experience of LB users feature MVP CLI labels Jan 22, 2018
@bajtos
Copy link
Member Author

bajtos commented Jan 22, 2018

@kjdelisle

I don't know if I can agree with this. As much as I like TDD and believe in the idea, I don't want to force users that don't want them to constantly be deleting them, or have to opt-out of them.
I do like the idea of potentially generating some basic unit tests for CRUD using an opt-in flag, but I definitely think it's out of the scope of the given sprint task.

I disagree. IMO, our CLI tooling should be guiding our users to do the right thing: use dependency injection to decouple different parts of their application, write a good test suite (see How to build a great test suite in our docs), etc.

If we want to make tests an opt-in feature of our CLI, then one can argue that dependency injection should be an opt-in feature too. When you don't write tests then you don't need dependency injection in your controllers and can hard-code direct reference on your models and repositories.

@bajtos bajtos added Core-GA and removed MVP labels Feb 1, 2018
@bajtos
Copy link
Member Author

bajtos commented Feb 1, 2018

@kjdelisle and me decided this does not really belong to MVP/Walking Skeleton.

@stale
Copy link

stale bot commented Oct 28, 2019

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Oct 28, 2019
@stale
Copy link

stale bot commented Nov 27, 2019

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Nov 27, 2019
@bajtos bajtos added help wanted and removed stale labels Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI developer-experience Issues affecting ease of use and overall experience of LB users feature help wanted
Projects
None yet
Development

No branches or pull requests

2 participants