A short Introduction to ScalaTest

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. ...

January 13, 2013 · 7 min · 1346 words · Micha Kops

New features in JUnit 4.11

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. Dependencies In older versions of JUnit there were two dependencies .. junit:junit contained an old version of hamcrest and could cause some nasty trouble .. junit:junit-dep just referenced hamcrest the maven way. Now with version 4.11 there is just junit:junit with clean references to hamcrest and junit:junit-dep is relocated to junit:junit. ...

November 18, 2012 · 4 min · 850 words · Micha Kops

Make your Tests more readable with custom Hamcrest Matchers

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. Adding jUnit and Hamcrest First add the dependencies for JUniti and Hamcrest to your project’s pom.xml or alternative build system. <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.3</version> <scope>test</scope> </dependency> </dependencies> ...

October 28, 2012 · 3 min · 610 words · Micha Kops