Posts Tagged ‘tdd’
Sunday, January 13th, 2013
ScalaTest is an excellent framework to write concise, readable tests for your Scala or Java code with less effort.
In addition it integrates well with a variety of frameworks like JUnit, TestNG, Ant, Maven, sbt, ScalaCheck, JMock, EasyMock, Mockito, ScalaMock, Selenium, Eclipse, NetBeans, and IntelliJ.
In the following short tutorial we’re going to write some tests using ScalaTest exploring features like rich matchers, BDD syntax support or web tests using Selenium/Webdriver.
(more…)
Tags: acceptance testing, bdd, flatspec, it, matcher, scala, selenium, tdd, test, testing, unit test, webdriver
Posted in Scala, testing | No Comments »
Thursday, December 6th, 2012
Sometimes we need to classify the tests in a project and a possible solution to achieve this goal is to assign different categories to the tests.
Often we’re doing this to separate the execution of fast-running and long-running tests or to run a specific set of tests that is only applicable in special situations.
To run a specific set of categorized tests there are different options and in the following tutorial we’ll be covering two of them: by configuring the Maven Surefire Plug-in or by using a JUnit Test Suite and the JUnit annotations.
(more…)
Tags: categories, junit, maven, suite, surefire, tdd, testing
Posted in Java, testing | No Comments »
Sunday, November 18th, 2012
JUnit is one of the most popular testing frameworks out there. Version 4.11 has just been released and offers some nice improvements that you shouldn’t miss.
(more…)
Tags: hamcrest, junit, matcher, maven, tdd, test, testing
Posted in Java, testing | 4 Comments »
Sunday, October 28th, 2012
Everyday we’re writing tests for our software and sometimes we’re in a situation where we’re testing a specific type or object very often.
Luckily Hamcrest allows us to create custom matchers by subclassing from a given variety of available matchers.
(more…)
Tags: hamcrest, junit, matcher, tdd, testing
Posted in Java, testing | No Comments »
Tuesday, July 31st, 2012
Having written some e-mail handling, sending or receiving library you’d like to run some integration tests against a real mail server?
Then GreenMail might help you out here .. the framework is not quite new on the market but it is really easy to setup IMAP,SMTP or POP3 services with it and it comes with some helpful libraries making your life a bit easier here.
That’s why I’ve come to the idea to share some examples for setting up different server instances, creating user accounts and – at last – fetching and validating e-mails…
(more…)
Tags: gradle, greenmail, imap, imaps, integrationtest, Java, javax.mail, mail, maven, pop3, smtp, smtps, tdd
Posted in Java, testing | No Comments »
Thursday, April 26th, 2012
Now that the long awaited stable version of the Arquillian framework is released I wanted to demonstrate some interesting features of this framework that really eases writing and running of integration tests for Java EE 6 applications in many different ways.
In the following tutorial we are going to create some real-world examples using Enterprise JavaBeans, Contexts and Dependency Injection, the Java Persistence API and we’re finally running Drone/Selenium tests against a JEE Web Application that is using Java Server Faces.
(more…)
Tags: arquillian, cdi, drone, ejb, glassfish, integration test, java ee, jboss, jee, jpa, jsf, selenium, tdd
Posted in Enterprise, Java, testing | 4 Comments »
Tuesday, March 6th, 2012
A lot has changed since Selenium RC and WebDriver has given us a new syntax to write tests for our web pages. PageObjects add an abstraction to the pages under test and finally we’re able to programatically start Selenium server instances and use them to run the tests.
In the following tutorial, we’re writing some tests using PageObjects, WebDriver, Selenium Server and finally we’re even taking some screenshots of our tested web pages..
(more…)
Tags: grid, junit, maven, pageobject, rc, regression test, selenium, tdd, testing, webdriver
Posted in Development, Java, testing | 1 Comment »
Tuesday, February 21st, 2012
JUnit Rules are a handy solution if one needs to alter test methods or wants to share common functionality between several test cases. JUnit 4.10 introduced a new class to order several rules according to our needs using a so called rule-chain.
In the following example, we’re going to create a simple custom rule and afterwards bind several instances of it in a specified order to a test method.
(more…)
Tags: Api, junit, rule, rulechain, tdd, testing
Posted in Java, testing | 2 Comments »
Tuesday, May 31st, 2011

Behaviour Driven Development is the keyword when we’re talking about test scenarios written in an ubiquitous language, strong interaction with stakeholders, product owners or testers and well described, common understandable test scenarios.
The popular JBehave framework is our tool of choice here and allows us to decouple our test stories from the test classes, offers an integration for web tests using Selenium and finally there’s a helpful Maven plugin for JBehave, too.
After a short excursion into the principles of Behaviour Driven Development we’re going to write and implement test stories for simple acceptance tests and web tests using selenium.
(more…)
Tags: acceptance test, agile, bdd, behavior, ddd, jbehave, scenario, selenium, story, tdd, testing, tutorial, xp
Posted in Java | 10 Comments »
Sunday, March 27th, 2011

Today we’re going to take a look at the Mockito framework that not only does sound like my favourite summer cocktail but also offers nice testing, mocking/stubbing, test-spying features and mock injections.
After that we’re going to take a look on how to mock static or final classes by extending Mockito’s capabilities with PowerMock.
(more…)
Tags: bdd, easymock, hamcrest, jmock, junit, mock, mock injection, mocking, mockito, powermock, stub, stubbing, tdd, testing, unit test
Posted in Java | 2 Comments »