반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- vscode
- pycharm
- classification
- CES 2O21 참가
- postorder
- paragraph
- inorder
- 재귀함수
- broscoding
- mglearn
- web 사진
- 웹 용어
- cudnn
- 결합전문기관
- 대이터
- KNeighborsClassifier
- html
- java역사
- web 개발
- web 용어
- bccard
- 머신러닝
- web
- C언어
- 자료구조
- 데이터전문기관
- Keras
- tensorflow
- CES 2O21 참여
- discrete_scatter
Archives
- Today
- Total
bro's coding
Spring.Junit(단위 테스트) 본문
반응형
JUnit 어노테이션
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
locations={"file:src/main/webapp/WEB-INF/spring-model.xml"})
@Test 해당 메서드를 테스트 대상으로 지정
TDD(Test Driven Development) Framework
porm.xml
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- spring junit -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.14.RELEASE</version>
</dependency>
package org.kosta.springmvc04.test;
import javax.annotation.Resource;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kosta.springmvc04.model.dao.DeptDAO;
import org.kosta.springmvc04.model.vo.DeptVO;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/root-context.xml" })
public class DeptJUnitTest {
@Resource
private DeptDAO deptDAO;
@Test
public void deptTest() {
// System.out.println(deptDAO.getTotalDeptCount());
// List<DeptVO> list = deptDAO.getAllDeptList();
// System.out.println(list);
// junit 관련 클래스 Assert
// 1. 기댓값 2. 실제값
// Assert.assertEquals(3, deptDAO.getTotalDeptCount());
// Assert.assertEquals(3, deptDAO.getAllDeptList().size());
// 부서번호 10을 이용해 부서정보를 검색하는 메서드를 테스트
String deptno = "10";
DeptVO vo = deptDAO.findDeptByNo(deptno);
// Assert.assertNotNull(deptDAO.findDeptByNo(deptno));
}
}
Ctrl+F11
반응형
'[IT] > Spring' 카테고리의 다른 글
SpringBoot.Gradle.mybatis.postgresql.thymeleaf.paging.pagehelper(페이지헬퍼로 페이징하기) (0) | 2021.09.30 |
---|---|
REST (0) | 2021.06.30 |
Spring.Tiles Framework (0) | 2021.06.22 |
Spring 설정 @Configuration @Bean (0) | 2021.06.22 |
Spring.modelAndView (0) | 2021.06.02 |
spring.객체 안 객체 접근(view) (0) | 2021.06.02 |
Spring.MVC (0) | 2021.06.02 |
Spring.AOP적용 단계 (0) | 2021.06.01 |
Comments