인프런 커뮤니티 질문&답변

감바스님의 프로필 이미지
감바스

작성한 질문수

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

JPA와 DB 설정, 동작확인

안녕하세요 No tests found for given includes: [jpabook.jpashop.MemberRepositoryTest](--tests filter) 이 에러가 나서 도움을 요청합니다.

해결된 질문

작성

·

1.8K

0

MemberRepositoryTest을 실행 했는데 아래와 같이 에러가 나옵니다

Execution failed for task ':test'.
> No tests found for given includes: [jpabook.jpashop.MemberRepositoryTest](--tests filter)

* 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.

 

MemberRepositoryTest코드
package jpabook.jpashop;

import static org.junit.Assert.*;

import jpabook.jpashop.Member;
import jpabook.jpashop.MemberRepository;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MemberRepositoryTest {
@Autowired MemberRepository memberRepository;
@Test
@Transactional
@Rollback(false)
public void testMember() {
Member member = new Member();
member.setUsername("memberA");
Long savedId = memberRepository.save(member);
Member findMember = memberRepository.find(savedId);
Assertions.assertThat(findMember.getId()).isEqualTo(member.getId());

Assertions.assertThat(findMember.getUsername()).isEqualTo(member.getUsername());
Assertions.assertThat(findMember).isEqualTo(member); //JPA 엔티티 동일성 보장
}
}

 

application.yml코드

spring:
datasource:
url: jdbc:h2:tcp://localhost/~/jpashop
username: sa
password:
driver-class-name: org.h2.Driver
jpa:
hibernate:
ddl-auto: create
properties:
hibernate:
# show_sql: true
format_sql: true

logging.level:
org.hibernate.SQL: debug
# org.hibernate.type: trace

 

build.gradle코드

plugins {
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'java'
}

group = 'jpabook'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-devtools'
implementation 'junit:junit:4.13.1'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
useJUnitPlatform()
}


인프런 질문에도 찾아보고 구글링도 해봤는데 뭐때문인지 몰라 질문을 합니다 도와주세요ㅠ
아래는 제코드 구글드라이브 공유링크입니다.
https://drive.google.com/drive/folders/1h5v97WrZW3rjxwzl_G2_73a17sXsQYpw?usp=sharing

답변 1

0

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

아래 링크의 답변들을 참고해주세요.

테스트 도중 에러 발생 - 인프런 | 질문 & 답변 (inflearn.com)

 

해결이 안될 경우 댓글남겨주세요

감사합니다.

감바스님의 프로필 이미지
감바스

작성한 질문수

질문하기