Testing Groovy with Nested Test Classes
The Groovy language allows testing with inline code, it provides the built-in JUnit, Mock, stubs, and other support. Presented here are two simple ways of embedding a JUnit test class inside a Groovy...
View ArticleGroovy implementation of INIX file format, part 2
Continued experimentation with the INIX “ini” file format. I take the original post code and add an alias feature. Background In three prior posts I presented a very simple metadata file storage...
View ArticleContinuous testing with Infinitest
With Infinitest every time you make a change in your code, the JUnit tests will be executed. How cool is that? Infinitest will run in IntelliJ or Eclipse. I tried it in a very small Groovy project, and...
View ArticleMock Java time and date using JMockIt
Example scenario: A class under test (CUT) gets the current date and uses collaborating classes that invoke month dependent rules. How can it be unit tested? Sure you can get the current date in the...
View ArticleForce failure of JavaScript promise in Dojo
For development and unit testing you may need to force a promise chain to fail in various ways. In listing 1 below is shown a simple XHR request. Now to make sure our promise chain error handling is...
View ArticleContinuous Integration (CI) misconception
In some online resources the term Continuous Integration (CI) is always used in the broadest sense to mean that on some schedule or event the outputs of every ongoing project or separate teams are...
View ArticleUnit testing Java exception handling using JMockIt
How do you test that a method caught an exception? What if that catch did not have a side effect, it just logged output, or simply swallowed the exception? Context We have a method in a class that was...
View ArticleSearch Java classpath for JUnit tests using Spring
A simple classpath scanner implementation that searches for classes having any method annotated with @Test or @RunWith. Spring Framework’s scanner utility is used to do this. Many tools and dev...
View ArticleContinuous Testing while developing, CDT?
I previously wrote about Continuous Testing here. Strange, at the time a web search turned up very little about the concept. What was found was the use of the term in the sphere of Continuous...
View ArticleHow to unit test Java servlets
The question of how to unit test Servlets comes up a lot. How can it be done? Should it be done? What are the options? A unit test, in the realm of xUnit semantics, is an isolated test of the smallest...
View Article