test

Use Case best practice: Test your Use Cases with real data alvin November 12, 2009 - 9:20am

Quite often when I’m asked to review a UML “Use Case” that someone else has written, I ask “Have you tested your Use Case with real data?” Sadly, the answer is usually “no.”

I don’t know why people don’t do this, but they don’t, and it seems like a very logical thing — essentially a unit test for Use Cases.

How to use ScalaCheck in the SBT REPL (command line)

If you add ScalaCheck to an SBT project like this:

libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"

it’s only available in the SBT “test” scope. This means that when you start a Scala REPL session inside of SBT with its console command, the ScalaCheck library won’t be available in that scope.

To use ScalaCheck with the SBT console (REPL), don’t use its console command — use test:console instead. A complete example looks like this:

$ sbt

> test:console

scala> import org.scalacheck.Gen.choose

Note that after you type test:console your project may be compiled, so that step may take a few moments.

In summary, use SBT’s console command to start a “normal” Scala REPL inside SBT, and use test:console to start a REPL that you can run tests inside of. (Note that this same advice also applies to using ScalaTest or specs2.)

One thing a business analyst should ask about any requirement

As a business analyst (or any person interested in writing software requirements and quality), there is one thing you should always ask yourself whenever you write a business requirement:

Is this software requirement testable?

I’ve seen some business analysts write some crazy things and call them requirements, but IMHO, if you can’t test it, it’s not a requirement.

Blue Origin in-flight “crew capsule” escape test

Yesterday’s Blue Origin in-flight “crew capsule” escape test is extremely cool. If you haven’t seen it yet, there’s an animation of what the test is supposed to accomplish starting just after 3:30, and then the launch is at 51:20. If you get tired of watching the launch, make sure you fast-forward to see the booster landing at the end:

Matt Cassel talking about Bill Belichick

Matt Cassel, talking about New England Patriots head coach Bill Belichick in this espn.com article:

My rookie year, I got crushed in the back by a corner blitz against the Giants. We’re playing them the next year in the last preseason game. He asks me, “OK, Cassel, what front do they like to bring the corner blitz from?” I had looked it up the night before, anticipating it. I said, “Coach, it’s an over.” And he goes, “Brady?” Well, you know immediately when he goes to the next guy: “Oh, no. Oh, no.” And Brady says, “An under.”

Then Bill goes, “Brady’s right. I don’t want to have to send your mother another note that says, ‘Dear Mrs. Cassel, we regret to inform you that your son got killed being a dumbass.’”

Fifty Shades of Mast Cell Disease

Doctor: I’d like to collect a bone marrow sample ...

*Al runs out of the hospital in a hospital gown, screaming like a little girl*


(later, after they caught me)

Doctor: The next time you break out in a rash, hives, or blisters, I want you to have those biopsied.

Me: Is there going to be any part of our relationship that doesn’t involve a lot of pain on my part?

Doc: Yes, pee in this cup, and we’ll look at it under a fluorescent light to see if you have the same disease that King George III had.

Me: The crazy one?

Doc: Yes.

Me: Cool.

Perl “file test” characters (for if/then tests) alvin June 28, 2016 - 4:18pm

This image comes from this Perl.org web page, and shows the Perl “file test” characters. As I show on this page, an if file test looks like this in Perl:

A Perl script to delete binary files alvin June 28, 2016 - 10:24am

As a quick note and a little bit of source code sharing, I wrote the following Perl script to delete all of the binary files it finds in a list of files it’s given. I named this script deleteBinaryFiles.pl, and it should be called like this:

deleteBinaryFiles.pl listOfFilesToLookAt

where listOfFilesToLookAt is a file that contains a list of filenames, with one filename per line.

Given that brief introduction, here’s the source code: