Thomas Sundberg

October 31, 2011

Why separate test definitions from a driving JUnit class?

Why should the step definitions be separated from the driving JUnit class when using Cucumber for Java?

(more…)

October 18, 2011

Testing a web application with Selenium 2

Selenium a great tool for testing web applications. The current version, Selenium 2, is a merge between Selenium and WebDriver. I will walk you through an example where we test a web site using Selenium in a few different ways. This is the same example as I demonstrated at Scandev on tour 18 October 2011.

(more…)

October 14, 2011

Maven Java heap space

I just had test in a Maven build fail with

java.lang.OutOfMemoryError: Java heap space

(more…)

October 6, 2011

Why isn’t my tests being executed?

Filed under: Automation, Maven, Programming — Tags: , , , , , , , , , , — Thomas Sundberg @ 17:19

Have you ever wondered why your Maven project doesn’t find and execute your tests?

(more…)

September 16, 2011

Test drive an implementation using an Executable Specification

An example is perhaps the best way to describe something. Concrete examples are easier to understand then abstract descriptions.

I will show how Cucumber-JVM can be used to specify an example and how the example can be connected to the system under test, SUT. The example can then be executed using any IDE or using Maven.

(more…)

August 7, 2011

Test drive the implementation of a database layer

Development guided by test is perhaps the best way to make sure that your solution works and is possible to verify. I will show how you can develop a database layer guided by tests. It will be divided into two parts. The first part will be an in memory solution and the second part will be implemented using Java Persistence API, JPA, and Hypersonic. The second implementation is supposed to replace the first one guided by the tests developed for the in memory solution.

(more…)

August 5, 2011

What is the difference between i++ and ++i?

Filed under: Clean Code, Java, Programming, Teaching — Tags: , , , — Thomas Sundberg @ 18:27

During a coaching session I got a question about a loop.

Would there be any difference in the output from a loop defined as

for (int i = 0; i < 3; i++) {
    System.out.print(i + " ");
}

and a loop defined as

for (int i = 0; i < 3; ++i) {
    System.out.print(i + " ");
}

in Java?

(more…)

July 28, 2011

Do not return null

Using your IDE to automatically create methods for you maybe a disaster waiting to happen.

(more…)

Magic numbers

The other day a colleague asked me, what is a magic number? He had noticed that one of the things our Sonar was complaining about was Magic numbers. I got a great teaching moment and told him my view of Magic numbers.

Magic numbers are any numbers in the source code that just appears without any explanation.

(more…)

June 10, 2011

Install a 3:rd part lib in Maven

Filed under: Automation, Maven — Tags: — Thomas Sundberg @ 13:27

Supose that you have a dependency that looks something like this:

<dependency>
    <groupId>foo</groupId>
    <artifactId>bar</artifactId>
    <version>1.0</version>
</dependency>

that can’t be resolved and the build fails with the error message below:

(more…)

« Newer PostsOlder Posts »

Theme: Customized Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.