Quantcast
Channel: T. C. Mits 108 » testing
Browsing all 18 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Exception verification using fault injection via AOP

A simple example is used to show how to use Aspect Oriented Programming to provide fault injection. Intro A few months ago I was looking at Java code and thinking there must be a better way to see if...

View Article


Image may be NSFW.
Clik here to view.

JMockit

Yesterday at work I gave a presentation on Unit Testing. It went well. 160 slides! And, no one passed out and hit the floor. One thing I mentioned was mocking frameworks and how JMockit is very useful....

View Article


Image may be NSFW.
Clik here to view.

Testing getter/setter using JUnit

So, I was thinking of testing my getter and setters in a JUnit test. Yea, I know it is not recommended, but I thought that I could write a simple reflective iterator that could do it without much fuss....

View Article

Image may be NSFW.
Clik here to view.

Unit Testing what will never happen?

Some developers refuse or are slow to test units for certain values or situations because, they claim, those values or situations will not occur. Some reasons given are that the presentation tier or UI...

View Article

Image may be NSFW.
Clik here to view.

Test Coverage Using JMockit

The JMockit Unit Testing library continues to astound. One new thing I discovered is its Coverage reporting. Code Coverage Code coverage is simply a measurement of what code has been actually run when...

View Article


Image may be NSFW.
Clik here to view.

Behavior counters for improved JUnit tests

A weak unit test may give false assurance if it is not responsive to API and test data changes. Introduction Recently I came across and even contributed some unit tests that were low quality. Not that...

View Article

Image may be NSFW.
Clik here to view.

Java JMockIt mocks via Spring DI

How to use Dependency Injected mock objects to allow Integration Testing of a Java application. When working with some legacy code bases, the introduction of Dependency Injection has limitations. Thus,...

View Article

Image may be NSFW.
Clik here to view.

Java testing using XStream, AspectJ, Vsdf

Problem A unit or integration test may require the creation of complex object structures. This is even more problematic in legacy systems that were not created with testability in mind. Faced with...

View Article


Image may be NSFW.
Clik here to view.

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 Article


Image may be NSFW.
Clik here to view.

Groovy 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 Article

Image may be NSFW.
Clik here to view.

Continuous 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 Article

Image may be NSFW.
Clik here to view.

Mock 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 Article

Image may be NSFW.
Clik here to view.

Force 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 Article


Image may be NSFW.
Clik here to view.

Continuous 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 Article

Image may be NSFW.
Clik here to view.

Unit 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 Article


Image may be NSFW.
Clik here to view.

Search 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 Article

Image may be NSFW.
Clik here to view.

Continuous 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 Article


Image may be NSFW.
Clik here to view.

How 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
Browsing all 18 articles
Browse latest View live