'2014/03'에 해당되는 글 1건

  1. 2014.03.15 about test layer

#define It is a my subjective opinion. :)

(Maybe you can see many broken English.. please don't surprise, instead, let me know about the incorrect part. )



Why we need test?

 

Of course, we need test to verify the functions we made are right.


it's includes the real environment.

 

I used to do JUnit test and try to many abnormal methods to verify functions. 

(of course, I always thinking "how can i do test better?")


And I admit the facts below.

 

1. most of all, i want to test which use external resources. 


(in fact, i can get peaceful mind when this test was finished)

 

This test includes many resources such as network, database, and so on.


i'm usually did unit-test for this test.

 

2. For example, when i want to check some data in DB, but data not exist at first time.


Therefore, the insert operations are needed before select operation. however, can we confident that insert operation is success?


If so, how about insert some data to DB manually? (this way is... look so little complex or dirty..)

 

3. I can't think about test layer well.

 

Recently i realized that test have some layers and the below layer's object can be substituted by "mock".

 

So, what is test layer? 


Above picture is appeared in my brain.

 

There are two parts, one is needed test in real environment, another one is can be substituted by mock.


So, i like to summarized below as a result.

 

  • Unit Test: the tests are processed at each layer. and below layers are substituted by mock. 
  • Integration Test: the tests are use external resources. real environment required to do this test. 

And this is what i want to get by test,

 

Check your business logic and program structure by "Unit Test", check your real environment(resources) by "Integration Test"

Link

it is a really good article: The correct way to use integration tests in your build process


'프로그래밍 > JAVA' 카테고리의 다른 글

java goto문  (1) 2013.08.05
Map 읽기 전용으로 만들기  (0) 2013.04.25
Posted by DevMoon
,