JBoss Community

Testsuite -refactoring to make test easier to run

created by Stefano Maestri in IronJacamar Development - View the full discussion

Hi all,

 

I'm working on our test suite. I'm trying to figure out not only how to achieve a better coverage, but also how to make current and future tests easier to read, write and run. Currently a lot (almost all) of our unit tests are deploying something on an embedded version of ironjacamar standalone server and then verify the deployment is correct and or stress some behavior of deployment environment.

And it's fine, since it is stressing an almost real environment. The problem there is this test need to deploy a rar file, and this rar have to be packaged before. We are hitting this goal with a dedicated ant task called prepare-test that is getting right classes and xmls and package all the rar needed for a group of tests.

The problem with this approach is that we always need to run them with ant, making much more difficult to run them inside an IDE and/or in a debug mode. Moreover, the opportunity for potential new contributor to sit in front of or code and play with a particular feature would be much easier if they can just take a unit tests and run it in debug mode and go step-by-step through our code.

 

Anyway to make this long story short, I'd like to purpose a refactoring of our test suite to make it possible like what I've done for this single test:

 

https://github.com/maeste/IronJacamar/commit/902423fdd0f6976a0c1d1d386d3b4a1a04b8b8aa

 

Of course some minor refinement should be done (like rename the test method calling it something like "shouldRegisterJndiNameAsSpecifiedByIronjacamarXml()"....much easier to understand for new contributors what is the purpose of the test), but you this commit should give you an idea. Please take a look and let me know your feedack

 

best regards

S.

Reply to this message by going to Community

Start a new discussion in IronJacamar Development at Community