Last active
August 29, 2015 14:16
-
-
Save yukinagae/997435273f3b803b9cd1 to your computer and use it in GitHub Desktop.
【STEP4】テスト : Scalaでコードを書く ref: http://qiita.com/yukinagae/items/038f75e9a1bf17978886
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scalatest._ | |
import com.example.Calculate | |
class AddSpec extends FlatSpec with MustMatchers { | |
"Calculate" should "addメソッドの 1 + 2 = 3" in { | |
val calculate = new Calculate() | |
val result = calculate.add(1, 2) | |
result must be === 3 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example | |
class Calculate { | |
def add(x: Int, y: Int): Int = { | |
x + y | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd [プロジェクトのルートディレクトリ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activator.bat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] HelloSpec: | |
[info] Hello | |
[info] - should have tests *** FAILED *** | |
[info] true was not equal to false (HelloSpec.scala:6) | |
[info] Run completed in 155 milliseconds. | |
[info] Total number of tests run: 1 | |
[info] Suites: completed 1, aborted 0 | |
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0 | |
[info] *** 1 TEST FAILED *** | |
[error] Failed tests: | |
[error] HelloSpec | |
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful | |
[error] Total time: 2 s, completed 2015/02/24 9:01:00 | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> ~test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2. Waiting for source changes... (press enter to interrupt) | |
[info] Compiling 1 Scala source to C:\workspace\minimal-scala\target\scala-2.11\test-classes... | |
[warn] there were two deprecation warnings; re-run with -deprecation for details | |
[warn] one warning found | |
[info] HelloSpec: | |
[info] Hello | |
[info] - should have tests | |
[info] Run completed in 125 milliseconds. | |
[info] Total number of tests run: 1 | |
[info] Suites: completed 1, aborted 0 | |
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0 | |
[info] All tests passed. | |
[success] Total time: 1 s, completed 2015/02/24 9:02:00 | |
3. Waiting for source changes... (press enter to interrupt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] HelloSpec: | |
[info] Hello | |
[info] - should have tests | |
[info] - should 1 + 1 = 2 | |
[info] Run completed in 141 milliseconds. | |
[info] Total number of tests run: 2 | |
[info] Suites: completed 1, aborted 0 | |
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0 | |
[info] All tests passed. | |
[success] Total time: 1 s, completed 2015/02/24 9:03:00 | |
4. Waiting for source changes... (press enter to interrupt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] HelloSpec: | |
[info] Hello | |
[info] - should have tests | |
[info] - should 1 + 1 = 2 | |
[info] Run completed in 141 milliseconds. | |
[info] Total number of tests run: 2 | |
[info] Suites: completed 1, aborted 0 | |
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0 | |
[info] All tests passed. | |
[success] Total time: 1 s, completed 2015/02/24 9:03:00 | |
4. Waiting for source changes... (press enter to interrupt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./activator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Hello" should "have tests" in { | |
true should be === true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Hello" should "have tests" in { | |
true should be === true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
true should be === true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] HelloSpec: | |
[info] Hello | |
[info] - should have tests | |
[info] Run completed in 203 milliseconds. | |
[info] Total number of tests run: 1 | |
[info] Suites: completed 1, aborted 0 | |
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0 | |
[info] All tests passed. | |
[success] Total time: 4 s, completed 2015/02/24 9:00:00 | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scalatest._ | |
class HelloSpec extends FlatSpec with MustMatchers { | |
"Hello" should "have tests" in { | |
true must be === true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment