How to write good test

Donghun Seol·2022년 12월 22일
0

좋은 테스트
애플리케이션 코드와 테스트코드의 지속적 통합발전

1. 테스트 코드 작성의 장점

enforces you to write cleaner code since complex functions are hard to test
splitting codes by standalone logic chunk is always recommended.

2. 테스트해아할 것과 하지말아야할 것

only test your code
test things that you can control

don't test 3rd party code
don't test node.js, browser api, api request itself

test your reaction to the response from api

3. 좋은 테스트 코드의 구성요소

Logical separation needed

AAA pattern for better structure of your test code

arrange
act
assert

Only test "one thing" per test

One feature or One behavior.

Focus on essential logic

Minimize expectation statements

profile
I'm going from failure to failure without losing enthusiasm

0개의 댓글