일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
- 역학
- 파이썬
- python
- 유닉스
- 시스템
- spring data jpa
- 코틀린
- 고전역학
- GPT-4's answer
- spring integration
- 자바암호
- chatGPT's answer
- 인프라
- 데이터베이스
- kotlin
- write by GPT-4
- 자바네트워크
- oracle
- Database
- JVM
- 자바
- write by chatGPT
- 웹 크롤링
- jpa
- 리눅스
- android
- NIO
- 소프트웨어공학
- Java
- flet
- Today
- Total
기억을 지배하는 기록
Java Testing with SPOCK 본문
SPOCK is a unit testing framework that in great exten utilizes Goovy’s syntax making your tests comprehensible and easy on the eyes. Spock makes writing tests fun.
Why SPOCK?
Spock is an alternative test framework written in the Groovy programming language.
A test framework automates the boring and repetitive process of manual testing, which is essential for any large application code base.
Although Spock is written in Groovy, it can test both Java and Groovy code.
Spock has built-in support for mocking and stubbing without an external library.
Spock follows the given-when-then code flow commonly associated with the BDD paradigm.
Both Groovy and Java build and run on the JVM. A large enterprise build can run both JUnit and Spock tests at the same time.
Spock uses the JUnit runner infrastructure and therefore is compatible with all existing Java infrastructure. For example, code coverage with Spock is possible in the same way as JUnit.
One of the killer features of Spock is the detail it gives when a test fails. JUnit mentions the expected and actual value, whereas Spock records the surrounding running environment, mentioning the intermediate results and allowing the developer to pinpoint the problem with greater ease than JUnit.
Spock can pave the way for full Groovy migration into a Java project if that’s what you want. Otherwise, it’s possible to keep your existing JUnit tests in place and use Spock only in new code.
Spock tests have the ability to include full English sentences in their code structures, allowing for easy documentation.
The first test
Java Class under test and JUnit test
SPOCK test for the Adder Java Class
The Second test
Multipler Class
A JUnit test for two Java classes
SPOCK test for two Java classes
SPOCK KNOWS ALL THE DETAILS WHEN A TEST FAILS
Failure of JUnit test in Eclipse
Failure of a SPOCK test in Eclipse
'오래된글 > Java' 카테고리의 다른 글
자바 nio - 1 (0) | 2018.04.09 |
---|---|
Java theory and practice: 웹 티어의 상태 복제 (0) | 2018.04.09 |
Java Persistence with MyBatis 3 (0) | 2018.04.09 |
Java performance tips-3 (0) | 2018.04.09 |
Java performance tips-2 (0) | 2018.04.09 |