[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12851732#action_12851732
 ] 

Konstantin Boudnik commented on ZOOKEEPER-725:
----------------------------------------------

bq. Cos, what's best practice for passing information into a test? In this case 
say we are passing the server port information into the client tests. How best 
to do this? jvm parameters (-Dzk.server.host1=host1:1234)? parameterized junit 
tests seem overkill for just a single test, no?

Unfortunately, JUnit (at least currently) isn't very flexible in this regard. 

TestNG is a way more advanced in this regard, but their sameVM model of test 
execution makes test development a more cumbersome task. However, the tests are 
coming out are more elegant and correct in comparison with JUnit approach of 
killing a VM after a test case execution. We already had an exercise with 
TestNG and you know what I meant :)

Possible ways to parametrize tests in JUnit are:
- sys. props in the command line/runtime as you have pointed out above
- sys. props set in a properties file
- using Fixtures aka @Before and @After methods. Using fixtures one can develop 
an elaborate setup method which might set certain states before a test case is 
started. The data for setting such state might be read from a file containing a 
set of parameters per line. Or it might be more "sophisticated" XML file. Or a 
configuration factory. Or something else...

Apparently, first two approaches are inferior to the latter way. However, it 
requires more ground work. Benefits are numerous. Not the least one is a 
significant simplification of build process.

> Test organization, methodology, and infrastructure improvements 
> ----------------------------------------------------------------
>
>                 Key: ZOOKEEPER-725
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-725
>             Project: Zookeeper
>          Issue Type: Test
>          Components: build, tests
>            Reporter: Konstantin Boudnik
>
> This is an umbrella feature for a number of improvements needed to happen in 
> ZK test realm

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to