Skip to content

Wakaleo Consulting

  Home

items tagged with Unit Testing

Grouping tests using JUnit categories
Written By: Administrator
Section: Articles and Resources

Category: Blog

2010-04-24 05:50:37

In a well-organized build process, you want lightning-fast unit tests to run first, and provide whatever feedback they can very quickly. A nice way to do this is to be able to class your tests into different categories. For example, this can make it easier to distinguish between faster running unit tests, and slower tests such as integration, performance, load or acceptance tests. This feature exists in TestNG, but, until recently, not in JUnit.

Indeed, this has been missing from the JUnit world for a long time. Using JUnit, I typically use test names (integration tests end in 'IntegrationTest', for example) or packages to identify different types of test. It is easy to configure a build script using Maven or Ant to run different types of test at different points in the build lifecycle. However it would be nice to be able to do this in a more elegant manner.


Read More About Grouping Tests Using JUnit Categories...


Junit Parameterized Tests and Hamcrest Asserts - a potent mix!
Written By: Administrator
Section: Articles and Resources

Category: Blog

2010-09-25 15:31:58

A recent question on Twitter about my JUnit Kung Fu talk got me thinking - is it possible to combine the expressivity of Hamcrest asserts with the power of parameterized testing? The answer is, of course, yes. Hamcrest expressions are not limited to assertThat statements - they can be used in isolation as well.


Read More About Junit Parameterized Tests And Hamcrest Asserts - A Potent Mix!...


Test-Driven Development and Software Quality
Written By: Administrator
Section: Articles and Resources

Category: Blog

2008-05-26 00:00:00

Any Test-Driven Development practitioner will tell you, Test-Driven Development is a design strategy, not a unit-testing technique. Writing unit tests are a means, not an end. The goal is to write better quality, more reliable, and more accurate code.


Read More About Test-Driven Development And Software Quality...


Testing Exceptions in JUnit 4.7
Written By: Administrator
Section: Articles and Resources

Category: Blog

2009-09-27 20:48:38

JUnit 4.7 introduced a few features that make it a little easier to work with exceptions. JUnit 4 introduced the expected parameter, which makes a test succeed if and only if a certain exception is thrown. For example, in the following code sample, we are testing a UserManager class. When the login() function is called, it should throw an UnknownUserException when no user is found.


Read More About Testing Exceptions In JUnit 4.7...


Tests first or tests last - come on, who cares?
Written By: Administrator
Section: Articles and Resources

Category: Blog

2008-06-02 00:00:00

Let's not be pedantic. Write unit tests before you code a method, or after it - in my experience, it matters little, as long as you think about and write the tests at roughly the same time as you write the code. It's coming back to do the tests later (or not coming back at all) which causes problems. Personally, I like to write unit tests just before or immediately after writing small chunks of code - it doesn't break the flow, because it is part of the flow.


Read More About Tests First Or Tests Last - Come On, Who Cares?...





There are 7 items tagged with Unit Testing. You can view all our tags in the Tag Cloud

<< Start < Previous 1 2 Next > End >>
Page 1 Of 2