Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Specs2入門

 Specs2入門

Nguyen Hong Phuc

October 21, 2016
Tweet

Other Decks in Technology

Transcript

  1. Simple BidRequest Tests ← CODE IS NOT “DRY” Take from:

    http://www.slideshare.net/ardentlearner/the-principles-of-good-programming
  2. Matcherの種類 Specs2で色々な Matcherが定義されている - StringMatchers - NumericMatchers - OptionMatchers -

    TraversableMatchers - FutureMatchers (scala.concurrent.Future) - FutureZMatchers (scalaz.concurrent.Future向け) - XorMatchers (catsライブラリ向け) - … Reference Card: https://etorreborre.github.io/specs2/guide/SPECS2-3.8.5/org.specs2.guide.matchers.ReferenceCard.html Matcher collection: https://github.com/etorreborre/specs2/tree/master/matcher/src/main/scala/org/specs2/matcher
  3. Fragmentsでテストを生成する package org.specs2 package specification package core object Fragments {

    … def foreach[T](seq: Seq[T])(f: T => Fragments): Fragments = ... } (c.fhttps://github.com/etorreborre/specs2/blob/master/core/src/main/scala/org/specs2/specification/core/Fragments.s cala#L116-L118)
  4. Fragmentについて “In specs2 a specification can simply be viewed as

    a sequence of Fragments.” そしてFragmentは - A Description - An Execution - An Example - ...