Saturday, April 25, 2009

Scala Testing Presentation Outline

Here's the outline for my upcoming presentation on Scala and Testing. It's a bit ambitious, and I know I won't get through it all, but that's okay. If there's anything glaringly missing, now is the last chance to let me know. It also seems like this could be the start of something bigger, like a short book called something like, "Scala Testing for Java Developers"...maybe. However, the talk is only geared toward Java developers for the first few minutes or so.

Without further ado:

1) The prereqs ... Just Java code
a) "Production" code
- A simple List interface
- An ugly LinkedList implementation
b) Testing Java with Java
- JUnit
- Testng

2) The basics ... Testing Java code with Scala
a) JUnit with Scala
- JUnit3 (test, setup/teardown)
- JUnit4 Annotations
b) TestNG with Scala
- @Test
- @DateProviders
- All Annotations available

3) The basics ... More testing Java with Scala - Intro to ScalaTest
a) Suite
- test methods
- assert with ===
- expect(x){}
- intercept
b) BeforeAndAfter
c) TimedTest (displays time information for each class and test ran)
d) TestNGSuite
- decorate original TestNG test from step 3, "with TestNGSuite"
- run in both runners

4) Scala extending/implementing Java classes/interfaces
a) ScalaLinkedList (simple extention of Java LinkedList class)
b) ScalaMutableList (ugly impementation of simple List interface)

5) Testing Scala with Scala
a) Briefly redo #4 - but by testing the new Scala code.
b) minor intermission - Can we backtrack and test the new Scala code with Java?

6) A nicer, Functional List implemention in Scala

7) Testing Scala with Scala
a) FunSuite
-(including HOF's for those who don't know...maybe?)
-explain how tests methods work

8) Advanced ScalaTest
a) ScalaTest matchers (in a FunSuite)
b) Overview of OOTB matchers
-String, List, Hash, Option matchers, etc.
c) Combining matchers with and/or
d) Extending ScalaTest matchers - Creating your own matchers

9) Specs
a) Specifications
b) Matchers
c) Extending Specs matchers - Creating your own matchers

10) Mocking in Scala (via Specs)
a) Mockito
b) JMock

11) ScalaCheck (via ScalaTest Checkers)
a) Properties
b) Generators
c) Arbitrary Magic

12) Ant
a) ScalaTest
b) JUnit Scala and Java run together
c) Specs runs as JUnit
d) TestNG Scala and Java run together

13) Scala Frameworks Interoperability
a) ScalaTest and Specs
b) ScalaTest and ScalaCheck
b) Specs and ScalaCheck


  1. Can you put a link to the presentation?

  2. Well, I did the presentation via intellij, didn't have slides, and didn't take video. However, I might try to put all the code for it up somewhere, and might even try to so some sort of a screencast. However I'm a bit busy. In the meantime I can help with any questions.

  3. It would be really nice to have some form of downloadable content!

  4. I would love to watch a screencast of this. It sounds like you're busy, but if you ever feel bored :) please consider committing this to video.