unit tests

ScalaCheck 2: A More-Complicated Example alvin December 19, 2017 - 4:55pm

“But I was trying to think why I don’t use QuickCheck — which is a very nice tool — more. I think it’s because the situations that cause me trouble are ones that I would find it difficult to generate test data for.”

Simon Peyton Jones, in the book, Coders at Work

In this lesson I’ll share a non-trivial example of how I used ScalaCheck to test a function I wrote recently.

ScalaCheck 1: Introduction alvin December 19, 2017 - 4:51pm

Once all of your functions work like algebraic equations, when you then look at an individual function it’s a simple step to wonder:

Two lessons on ScalaCheck alvin July 6, 2017 - 8:06am

The next release of my book on Scala and functional programming will include at least two lessons on ScalaCheck.

If testing costs more than not testing, then don’t test alvin May 17, 2017 - 3:17pm

“If testing costs more than not testing, don’t test.”

~ Kent Beck (via this twitter page)

Program testing can be used to show the presence of bugs ... alvin May 15, 2017 - 10:58am

“Program testing can be used to show the presence of bugs, but never to show their absence.”

~ Edsger Dijkstra

ScalaTest 112: How to run ScalaTest unit tests in Eclipse alvin February 16, 2014 - 2:48pm

Problem: How do I use ScalaTest in Eclipse (or, How do I run my ScalaTest unit tests from Eclipse?)


I do a lot of work from the command line with Ant builds and similar things, but there are times I like to do things through Eclipse. Today I wanted to run my ScalaTest unit tests in Eclipse, and found this to be a straightforward task.

Besides Scala, Eclipse, and an Eclipse project, you'll need:

Scala - calling foreach on a Seq to populate sample data alvin November 28, 2012 - 5:08pm

I just saw the following Scala source code in a Play Framework 2 sample application, and it struck me as a nice example of how to call the foreach method on a Seq to populate some sample data:

CakePHP automated web testing with SimpleTest alvin January 30, 2011 - 12:54pm

CakePHP/SimpleTest automated web testing: Can you share an example of some automated CakePHP SimpleTest web tests?

Sure, here's a quick look at how I've created a suite of CakePHP automated web tests using SimpleTest to perform integration testing on a new CakePHP web application.

The recipe for creating automated web tests in CakePHP is fairly simple:

CakePHP web testing - deleting database test data alvin January 30, 2011 - 12:47pm

CakePHP delete database test data FAQ: How can I delete CakePHP test data from my database in automated CakePHP unit and web tests (integration tests)?

I recently created a large set of CakePHP unit tests and CakePHP web tests (essentially integration tests), and as part of thorough testing, I needed to be able to create some user accounts and insert some test data into the database.

Wed, May 14, 2003 alvin May 14, 2003 - 6:24am

Here's the material from a seminar I've done several times on "Working Backwards with JUnit". The idea for this seminar came about from an article of the same name by several authors in the Extreme Programming blue book. I can't remember their names right now, but all of the credit goes to them for the idea, and I need to acknowledge them properly.