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

Improve Kotlin integration testing documentation #22875

Closed
mattbaumann opened this issue May 2, 2019 · 4 comments
Closed

Improve Kotlin integration testing documentation #22875

mattbaumann opened this issue May 2, 2019 · 4 comments
Assignees
Labels
in: test Issues in the test module type: documentation A documentation task
Milestone

Comments

@mattbaumann
Copy link

Affects: \5.2.0.M1


I just read the kotlin documentation for spring testing framework

In my opinion is the unit test documentation is mature.
On the other hand, I would like to see a more detailed documentation related to integration testing. Specially, how I can mock transitive dependencies with mockk in the component testing environment.

Example:
I test SampleController which depends on SampleService. In an @WebMvcTest(SampleController::class)-Test, how can I inject a mock of the SampleService into the SampleController, which is under integration test?

Context:
The bean SampleService Bean is not loaded in the test application-context with the @WebMvcTest-Annotation. Therefore, instead of dependency injection, I would like to do mock injection. Preferably with mockk mocks. I chose mockk to be in line with unit test mocking framework under kotlin.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 2, 2019
@sbrannen
Copy link
Member

@sdeleuze, can you provide any insight here?

@sbrannen sbrannen added the type: documentation A documentation task label May 12, 2019
@sbrannen sbrannen changed the title Integration Test in reference documentation Add integration test for Kotlin in reference documentation May 12, 2019
@sbrannen sbrannen changed the title Add integration test for Kotlin in reference documentation Add example integration test for Kotlin in reference manual May 12, 2019
@mattbaumann
Copy link
Author

I'm currently using springmockk for doing the job. The technical issue was denied. I agree with the denial, but would appreciate, when the spring team gives another guideline to do the job.

@sdeleuze
Copy link
Contributor

SpringMockk is indeed great but is a Spring Boot level feature, and is mentioned in Spring Boot reference documentation.

I understand that the split can be sometimes confusing for developers, but we need to respect this split in our documentation. Maybe we could add more links from Framework to Boot documentation here @sbrannen ?

@sbrannen
Copy link
Member

Maybe we could add more links from Framework to Boot documentation here @sbrannen ?

Sure. Feel free to propose where you think we should cross-reference Boot.

For starters, we could add links to Spring Boot's testing chapter and SpringMockK in the Further Resources section of the Testing chapter.

@sbrannen sbrannen added in: test Issues in the test module and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 23, 2019
@sbrannen sbrannen added this to the 5.2 RC1 milestone May 23, 2019
@sbrannen sbrannen removed their assignment Jun 18, 2019
@sdeleuze sdeleuze changed the title Add example integration test for Kotlin in reference manual Improve Kotlin integration testing documentation Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

4 participants