inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

회원 리포지토리 테스트 케이스 작성

test가 작동하지 않아요

942

minhyuck WOO

작성한 질문수 8

0

Run 하는 부분부터 선생님이랑 뜨는 메뉴도 다르고 

save() run 이라고 표시되지도 않아요

오류 창에는 

C:\Users\user\OneDrive - (  ) ̳ ׷ \     ȭ  \hello-spring\src\test\java\hello\hellospring\HelloSpringApplicationTests.java:4: error: package org.springframework.boot.test.context does not exist

import org.springframework.boot.test.context.SpringBootTest;

                                            ^

C:\Users\user\OneDrive - (  ) ̳ ׷ \     ȭ  \hello-spring\src\test\java\hello\hellospring\HelloSpringApplicationTests.java:6: error: cannot find symbol

@SpringBootTest

 ^

  symbol: class SpringBootTest

2 errors

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':compileTestJava'.

> Compilation failed; see the compiler error output for details.

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

3 actionable tasks: 1 executed, 2 up-to-date

이런식으로 뜨는데 오류내용을 아무리 검색해봐도 비슷한것도 나오질 않아요 어떻게 해야하나요?

java spring-boot MVC spring

답변 3

0

OMG

안녕하세요. minhyuck WOO님, 공식 서포터즈 OMG입니다.

프로젝트 확인해보았습니다 .두 가지 문제점이 보입니다.

1)

EqualsTo가 아니라 EqualTo입니다.

2)

dependencies 안의 implementation 'org.springfram~ : 버전 을 작성하지 않으셔도 됩니다.

현재 최상단의 스프링부트와 버전 차이가 나지 않도록 해주세요.

build.gradle 수정하여assertj 가 들어오지 않는 것으로 보입니다.

그리고 현재 스프링부트 프로젝트 생성 가능한 버전이 강의 제작 시점과 다른데요,

2.5.x 대에서 뒤에 영문자가 없는 버전을 고르시면 됩니다.(2.5.4 버전)

프로젝트 새로 만드시고 기존 코드 옮기시면 될 것 같습니다. 오타에 유의하시구요.

감사합니다.

0

minhyuck WOO

https://drive.google.com/file/d/1iNHUMXk-M8xDaSYwLpZAtwUtSkk0s-Ry/view?usp=sharing

1. 인텔리 J로 실행하고 있습니다.

2. local실행은 잘되는데 test 실행시 

Could not find org.springframework.boot:spring-boot-stater-test:.

Required by:

    project :

Possible solution:

 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

와 같은 오류가 발생하는데 검색해보니까 의존성을 찾을 수 없는 오류라고 하여 해결법을 따라해 보았지만 여전히 같은 상황이 반복되고있고 

또한 

Assertions.assertEquals(result, member);

        Assertions.assertThat(member).isEqualsTo(result);

        Assertions.assertThat(); 구문에서 자꾸 오류가 발생하여 다른 학습자분께 답해주신걸 참고하여  

import org.assertj.core.api.Assertions;

를 추가하라고 하신것을 찾았으나 제 프로젝트에 똑같이 작성하였는데도 여전히 import 되지 않고 있는게 문제입니다.

0

김영한

안녕하세요. minhyuck WOO님

전체 프로젝트를 압축해서 구글 드라이브로 공유해서 링크를 남겨주세요.

구글 드라이브 업로드 방법은 다음을 참고해주세요.

https://bit.ly/3fX6ygx

추가로 다음 내용도 코멘트 부탁드립니다.

1. 실행 방법을 알려주세요.

2. 어떻게 문제를 확인할 수 있는지 자세한 설명을 남겨주세요.

감사합니다.

인텔리제이 오류

0

40

1

..

0

103

2

Unused property.....

0

116

2

project JDK is misconfigured

0

157

2

외부 API의 ID 타입(String/UUID)과 내부 도메인의 ID 타입(Long)이 불일치할 때의 설계 정석

0

97

2

단위/통합 테스트 버전충돌 문제

0

97

2

❗️springboot 4.0.2 버전 aspectj dependency 설정❗️

0

246

1

왜 컨트롤러는 변한게 없는데 새로 만든 html 파일이 뜨나요?

0

116

2

윈도우 build test오류 질문

1

115

2

테스트 관련 공부에 대한 조언을 얻고 싶습니다

0

108

2

테스트 실행 시 에러 질문

0

306

1

name을 통한 비교와 객체를 통한 비교

0

79

1

빌드 후 libs 없음

1

142

1

윈도우 gradlew.bat 에러

0

179

1

@PostMapping("/members/new")가 동작하지 않습니다

0

97

1

java static class와 kotlin class

0

87

1

스프링 DB연결

0

140

1

소요 시간

0

96

2

ddl.sql에 빨간 밑줄

1

112

2

welcome page 에러

0

195

3

잘 모르겠습니다.

0

170

2

fail을 똑같이 쳤는데 오류가 발생해요

0

169

2

index.html Welcome page

0

133

1

프로젝트 gradle-groovy ?

0

396

1