Skip to content

Standardize testing tools #77

Closed
Closed

Description

@counterleft

From looking at the tests across this repo @ 6753d9c, it looks like junit is the defacto test runner:

$ git grep testCompile
_template/build.gradle:  testCompile "junit:junit:4.10"
accumulate/build.gradle:  testCompile "junit:junit:4.10"
allergies/build.gradle:  testCompile "junit:junit:4.10"
anagram/build.gradle:  testCompile "junit:junit:4.10"
atbash-cipher/build.gradle:  testCompile "junit:junit:4.10"
binary/build.gradle:  testCompile "junit:junit:4.10"
bob/build.gradle:  testCompile "junit:junit:4.10"
crypto-square/build.gradle:  testCompile "junit:junit:4.10"
etl/build.gradle:  testCompile "junit:junit:4.10"
etl/build.gradle:  testCompile "org.easytesting:fest-assert-core:2.0M10"
etl/build.gradle:  testCompile "com.google.guava:guava:16+"
gigasecond/build.gradle:  testCompile "junit:junit:4.10"
grade-school/build.gradle:  testCompile "junit:junit:4.10"
grade-school/build.gradle:  testCompile "org.easytesting:fest-assert-core:2.0M10"
hamming/build.gradle:  testCompile "junit:junit:4.10"
hello-world/build.gradle:  testCompile "junit:junit:4.10"
luhn/build.gradle:  testCompile "junit:junit:4.10"
meetup/build.gradle:  testCompile "junit:junit:4.10"
meetup/build.gradle:  testCompile "org.easytesting:fest-assert-core:2.0M10"
nucleotide-count/build.gradle:  testCompile "junit:junit:4.10"
nucleotide-count/build.gradle:  testCompile "org.easytesting:fest-assert-core:2.0M10"
octal/build.gradle:  testCompile "junit:junit:4.10"
pangram/build.gradle:  testCompile "junit:junit:4.10"
pascals-triangle/build.gradle:  testCompile "junit:junit:4.10"
phone-number/build.gradle:  testCompile "junit:junit:4.10"
pig-latin/build.gradle:  testCompile "junit:junit:4.10"
prime-factors/build.gradle:  testCompile "junit:junit:4.12"
raindrops/build.gradle:  testCompile "junit:junit:4.10"
rna-transcription/build.gradle:  testCompile "junit:junit:4.10"
robot-name/build.gradle:  testCompile "junit:junit:4.10"
roman-numerals/build.gradle:  testCompile "junit:junit:4.10"
scrabble-score/build.gradle:  testCompile "junit:junit:4.10"
sieve/build.gradle:  testCompile "junit:junit:4.10"
simple-cipher/build.gradle:  testCompile "junit:junit:4.10"
space-age/build.gradle:  testCompile "junit:junit:4.10"
strain/build.gradle:  testCompile "junit:junit:4.10"
triangle/build.gradle:  testCompile "junit:junit:4.10"
trinary/build.gradle:  testCompile "junit:junit:4.10"
word-count/build.gradle:  testCompile "junit:junit:4.10"

We're not consistent on which assertion methods to use. Some tests use either junit's assertEquals(), others use junit's assertThat() or fest-assert's assertThat().

  1. Should we pick one version of junit and use that across the board?
  2. Should we pick one assertion API and stick with it? Note that fest-assert seems to be replaced by AssertJ (FWIW).

The latest version of junit in maven central is 4.12, so I'd vote for that.

I'm partial to variations of assertThat() because of matcher support (for Collection classes, arrays, etc). But I don't have a strong opinion aside from that.

Activity

  1. sit commented on Dec 24, 2015

    @sit
    Contributor

    Good idea. Put up a PR that uses junit 4.12 and converts existing fest asserts to assertj.

  2. jtigger commented on Dec 25, 2015

    @jtigger
    Contributor

    Thanks for calling this our @winterchord.

    @sit's PR was spot on.

    JUnit is still the de facto testing framework in Java (not to spark a religious war with TestNG supporters); with JUnit Lambda getting legs (full disclosure: I work for Pivotal), the long-overdue overhaul is underway.

    AssertJ is the most feature reach and fluent assertion framework in Java I'm aware of; great pick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions