--- In jug-indonesia@yahoogroups.com, "Thomas Wiradikusuma"
<[EMAIL PROTECTED]> wrote:
>
> here's my rule of thumb concerning testing:
> 
> 1. unit test services using mock for dependent classes (usually lower
> lever services, usually DAO)
>     objective: correctness of logic and dependency invocations
> 2. unit test DAO, hitting real DB using rollback and sample data
>     objective: correctness of mapping (if using ORM) and correctness
> of persisted data
> 3. ... dsb dsb (yg terpenting dalam konteks thread ini dua di atas)
> 
> my rule of thumb of DAO-testing:
> 1. it should be tested using real DB
> 2. if real DB is inappropriate, use another DB (say HSQL)
> 3. if you can't hit DB because your logic is too complex, then
> probably you put too much responsibility for that DAO.
>     consider refactoring the DAO, pushing as much logic to upper layer
> (if desirable)

saran yang bagus, thanks. membaca ini, saya rasa perlu utk memperbaiki
struktur testing saya, seperti utk testing DAO, hrs hit lsg ke
database. Skrg saya terlanjur deploy ke MySQL, baru kepikiran utk
pakai HSQL, mau dipindah dgn sqldump, file .sql tidak cocok dgn HSQL,
mau diedit file .sql nya, terlalu byk kerjaan, krn tablenya udah
banyak kali. Ada tools lain yang bisa eksport ke .sql murni ANSI ?

bolehkah saya bilang kalau yang ngurusin beginTransaction() adalah di
class2 Service ? atau harus ditaruh di DAO ? Karena di sela2
transaction pasti ada perhitungan dan business logic nya.

Kirim email ke