Showing posts with label JUnit. Show all posts
Showing posts with label JUnit. Show all posts

13.12.11

Exubero - JUnit Anti-patterns

unit testing - How to avoid multiple asserts in a junit test - Stack Overflow
Exubero - JUnit Anti-patterns
JUnit FAQ

Test Often.: JUnit Best Practices, Part 2 -- Keep 'em Separated
  • The purpose of unit testing is to take the guesswork out of error location.
  • Testing many different behaviors in a single test method is a common practice because it's so easy to do, but this is a clear case of being penny-wise and pound-foolish. Take the time to separate each behavior into its own unit test.
  • when the method under test performs more complex tasks, it's tempting to add multiple assertions to your JUnit tests to verify several different behaviors at once. Despite appearances, however, this approach can actually increase your overall testing time and effort.
  • JUnit tests are designed to fail as soon as the first assertion fails.
  • Since your brain is required for each debug/fix effort, this process cannot be automated.
  • A better approach would be to split this one test method into three tests, each with a single assertion
  • True, your test suite has increased in size, from one test to three, but you've always had three tests all along anyway, and this change merely reorganizes your test suite to reflect that.
  • More importantly, striving for one assertion per unit test streamlines the test-debug-retest cycle and improves the overall testing effort.

12.12.11

Why You Should Write Unit Tests - Testing Techniques 8 | Javalobby


  • certain classes may not need unit tests.

UnitilsJUnit4TestClassRunner

Summary

Unitils is an open source library aimed at making unit and integration testing easy and maintainable.
It is divided into several modules, each of them providing extra support for a certain aspect of your unit and integration tests. If you for example need mocking for your tests, just include unitils-mock as a dependency. If you would also want to load DbUnit data sets, just include unitils-dbunit.

7.12.11

OSGi - Automated, unit and integration tests with JUnit | Software is art

OSGi - Automated, unit and integration tests with JUnit | Software is art

CBD - Component Based Development

Component-based software engineering - Wikipedia, the free encyclopedia



iPOJO


iPOJO is a service component runtime aiming to simplify OSGi application development. It natively supports ALL the dynamism of OSGi. Based on the concept of POJO, application logic is developed easily. Non-functional properties are just injected in the component at runtime.

iPOJO strength points are :
  • components are developed as POJO, nothing else is required !
  • the component model is extensible, so feel free to adapt it to your needs
  • the standard component model manages service providing and service dependencies, and so can require any other OSGi services
  • iPOJO manages the component instance lifecycle and the environment dynamics as it has never been possible
  • iPOJO provides a powerful composition system to create highly dynamic applications
  • iPOJO supports annotations, XML or Java-based API to define the component


JUnit4OSGi

Apache Felix - apache-felix-ipojo-junit4osgi

JUnit4OSGi is a test framework executing JUnit tests on an OSGi runtime. JUnit4OSGi provides a JUnit++ environment specialized for OSGi, several runners and a maven plugin executing your tests during your build process

28.11.11

Fit: Framework for Integrated Test

Wiki: Welcome Visitors

I got this web site from JUnit Recipes.

Manning: JUnit Recipes


It is a spread-sheet - or table-based way to write Customer Tests and may be the next big wave in testing.

Some Useful Links for JUnit 4: Parameterized Test

JUnit 4 Tutorial 6 – Parameterized Test
Abhi On Java: Unit Testing with JUnit 4.0
Writing a parameterized JUnit test « Our Craft

1. @RunWith(Parameterized.class)
2. Constructor with parameter(s)
3. @Parameters for a static method which returns Collection<Object[]>

Parameterized Unit Test is the same as the Data-Driven Test Suite idea in JUnit Recipes (4.8)