I would second David's second point. If you are writing your Unit Test,
then focus on what Unit Test should do. Starting a full server is a good
way to unit test your code? I'd say no. If you do that, you will make
your maven build process to have another dependency. If your test server
dies, you won't be able to build (unless you skip test, which just beats
the whole purpose).

Starting a full sever and going through something like prod env belongs
to PSR type of domain. Don't get me wrong, it is critical. But you
should separate them out.

Thanks,
Yong


-----Original Message-----
From: David Rosenstrauch [mailto:[email protected]] 
Sent: Tuesday, June 09, 2009 8:08 AM
To: [email protected]
Subject: Re: Exceptions in MINA

Michael Ossareh wrote:
> Hi David,
> 
> Thanks for your feedback. I noted your example and my reference to
> "solution to this" looks not to dissimilar from what you're doing
> (except I don't want to change the filter chain for fear of creating a
> difference between prod and dev). The same goes for dummy session. As
> I get more to grips with MINA I'm sure my assertions as to how to
> build the tests will change.
> 
> Cheers,
> 
> mike

I understand your concerns about not wanting to make a difference 
between dev and prod.  But I'd offer 2 pieces of feedback:

1) Just adding a listener at the end of your filter chain isn't really 
introducing any real change in behavior in your test filter chain.

2) Is it really necessary to have identical conditions between dev and 
prod for every single test?  I'd argue no.  You can have some tests that

test for correct behavior, others that test network I/O, etc..  Given 
that, you can set up one set of tests that just do black-box testing 
directly against your server's filter chain (as in my example), in order

to verify that specific inputs generate expected outputs.  Then, 
separately, you can write additional tests against the full server (and 
thus the prod filter chain) via a socket to test the server's network 
I/O, performance, etc.  If you handle the two kinds of tests separately 
it makes your testing job simpler.

HTH,

DR

Reply via email to