This page is no longer maintained — Please continue to the home page at www.scala-lang.org

ScalaTest 1.0 Released

Bill Venners, President of Artima has announced the availability of ScalaTest 1.0, an open source application for concisely creating test code for Java platform based applications that can run on multiple processor cores for parallel testing.

The principal contributors Bill, George Berger and Josh Cough have exploited the syntactic power of Scala to create a powerful testing framework that speeds up the whole testing process. The test code is intuitive to understand and is expressed in a very natural style. Thomas Knierim, a satisfied user, says of Scalatest "Nice piece of software. Simple and straightforward to use. I dropped the new jars into my existing Ant projects and the unit tests worked right out of the box."

On the ScalaTest Web site you will find the following example test code for a stack. As you see, it requires little explanation to comprehend its intent but if you are curious to understand how Scala syntax has been used to achieve such a natural style see Bills explanation here.

import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
class StackSpec extends FlatSpec with ShouldMatchers {

   "A Stack" should "pop values in last-in-first-out order" in {
       val stack = new Stack[Int]
       stack.push(1)
       stack.push(2)
       stack.pop() should equal (2)
       stack.pop() should equal (1)
    }
    it should "throw NoSuchElementException if an empty stack is popped" in {
      val emptyStack = new Stack[String]
      evaluating { emptyStack.pop() } should produce [NoSuchElementException]
    }
  }  

ScalaTest has been designed to support a broad range of development methodologies for example test-driven and behavior-driven and popular testing practices such as unit, functional, integration or acceptance tests.

If you are already a ScalaTest user then you will find that 1.0 improves integration with JUnit, JMock, EasyMock and Mockito and provides additional BDD traits of FlatSpec, FeatureSpec and WordSpec. You can pass "fixtures" into tests with a functional style using the new FixtureSuite and add documentation to tests that selectively appear on test reports using the GivenWhenThen trait.

ScalaTest now provides a Conductor class to manage multi-threaded testing of concurrency abstractions as well as reordering reports sequentially after multiple processor parallel testing.

So if you are looking for a framework that allows you to test Scala or Java code in a concise, highly customizable way then ScalaTest could be just the thing for you.

To find out more you can see Bill talk about ScalaTest at Devoxx 2009 on the 16-20 November at Antwerp, Belgium or visit the ScalaTest Web site. Perhaps read other reports on the announcement DrDobbs or DZone.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland