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

Contributing and unit tests #24299

Closed
JimStockwell opened this issue Nov 30, 2020 · 3 comments
Closed

Contributing and unit tests #24299

JimStockwell opened this issue Nov 30, 2020 · 3 comments
Labels
status: superseded An issue that has been superseded by another

Comments

@JimStockwell
Copy link
Contributor

The "Code Conventions and Housekeeping" section of CONTRIBUTING.adoc says,
"A few unit tests would help a lot as well -- someone has to do it."

Is there a standardized way of running such unit tests, for example, the ones in the org.springframework.boot.actuate.endpoint.EndpointIdTests class?

I think there would be value in addressing that question right there in CONTRIBUTING.adoc.

If I can wish, I wish for something as convenient as ./gradlew test --tests EndpointIdTests.

Thank you for your thought and consideration. Spring Boot is a great help to all the world.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 30, 2020
@snicoll
Copy link
Member

snicoll commented Nov 30, 2020

Thanks for the suggestion. We can add something like that although I'd rather have it generalized so that it also runs other checks (such as checkstyle and code format).

I have this on my zsh profile:

function check() {
  g check test --tests "$1*"
}

Running check and test makes sure the code is formatted properly and it also runs tests starting with the first argument so check Tomcat would run checks in the current module and all tests starting with Tomcat.

If I can wish, I wish for something as convenient as ./gradlew test --tests EndpointIdTests.

I am confused as this command does exactly what you've asked. Have I missed something?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Nov 30, 2020
@JimStockwell
Copy link
Contributor Author

JimStockwell commented Nov 30, 2020

Thank you @snicoll , that's just what I'm looking for. But now I discover that although the right way is simple, it doesn't work for me. (Or I'm missing something else.)

Sorry to turn this into a debugging session. Can you help me here? When I try the following:

./gradlew check test --tests EndpointIdTests

I get back:

Execution failed for task ':spring-boot-project:spring-boot:test'.
> No tests found for given includes: [EndpointIdTests](--tests filter)

I'm not familiar with Gradle, so I won't be surprised if that's a big part of my problem. Is there an obvious thing I'm doing wrong? EndpointIdTests seems like a valid unit test to me. It's in spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EndpointIdTests.java.

Thanks again.

Edit: Oh. It works well. I see I needed to pay more attention to your phrase "in the current module". Thank you!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 30, 2020
@snicoll
Copy link
Member

snicoll commented Nov 30, 2020

This issue is now superseded by #24301.

@snicoll snicoll closed this as completed Nov 30, 2020
@snicoll snicoll added status: superseded An issue that has been superseded by another and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

No branches or pull requests

3 participants