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

✨ add rest docs and swagger ui for category test #102

Merged
merged 6 commits into from
Jul 26, 2024
Merged

Conversation

hyxrxn
Copy link
Contributor

@hyxrxn hyxrxn commented Jul 25, 2024

build.gradle에 의존성과 task를 추가해 rest docs와 swagger ui를 도입했습니다.

사용 방법은 다음과 같습니다.

  1. 컨트롤러 E2E 테스트를 RestDocsSetting을 상속받게 변경합니다.

  2. 각 테스트에 rest docs에서 요구하는 요소를 추가합니다.

    • given에 파라미터로 spec을 넣습니다. specRestDocsSetting에 이미 정의되어있으니 가져다 쓰시면 됩니다.
    • given.log.all 뒤에 filter 메서드를 추가합니다. 형태는 CategoryControllerTest를 보시면 이해가 빠를 겁니다.
    • 뭘 추가해야할지 모르시겠다면... 불러주세요. 함께 공부합시다.
  3. 이후 Gradle bootJar을 실행하면 openapi3.yaml 이 resources/static 으로 들어옵니다.

  4. http://localhost:8080/swagger-ui/index.html로 접속하면 기존의 swagger로 만든 api 문서와 동일한 결과를 보실 수 있습니다.

궁금한 부분이 있다면 질문 주세요.
special thanks to 새양 입니다.

@hyxrxn hyxrxn added docs Improvements or additions to documentation BE Backend labels Jul 25, 2024
Copy link

Overall Project 89.63% 🍏

There is no coverage information present for the Files changed

Copy link

@HaiSeong HaiSeong left a comment

Choose a reason for hiding this comment

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

👍

Copy link

@tackyu tackyu left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다!

Copy link

@oshyun00 oshyun00 left a comment

Choose a reason for hiding this comment

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

통합 테스트에서 공통된 부분은 상속받아서 사용할 수 있어서 좋네요.
어려운 부분이었을 것 같은데 고생 많으셨습니다.

Copy link
Contributor

@geoje geoje left a comment

Choose a reason for hiding this comment

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

고생하셨어요 아토~~ 테스트 코드에 response 추가된 너무 굿굿!

@hyxrxn hyxrxn merged commit b10a175 into be/dev Jul 26, 2024
1 check passed
@hyxrxn hyxrxn deleted the be/feat/28 branch July 26, 2024 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE Backend docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants