You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _overviews/scala-book/sbt-scalatest-bdd.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ class MathUtilsSpec extends FunSpec {
69
69
70
70
As you can see, this is a very different-looking style than the TDD tests in the previous lesson. If you’ve never used a BDD style of testing before, a main idea is that the tests should be relatively easy to read for one of the “domain experts” who work with the programmers to create the application. A few notes about this code:
71
71
72
-
- It uses the `FunSpec` class where the TDD tests used `FunSuite`
72
+
- It uses the `AnyFunSpec` class where the TDD tests used `AnyFunSuite`
73
73
- A set of tests begins with `describe`
74
74
- Each test begins with `it`. The idea is that the test should read like, “It should do XYZ...,” where “it” is the `double` function
75
75
- This example also shows how to mark a test as “pending”
@@ -95,7 +95,7 @@ With those files in place you can again run `sbt test`. The important part of th
Copy file name to clipboardExpand all lines: _overviews/scala-book/sbt-scalatest-tdd.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -38,15 +38,15 @@ version := "1.0"
38
38
scalaVersion :="{{site.scala-version}}"
39
39
40
40
libraryDependencies +=
41
-
"org.scalatest"%%"scalatest"%"3.0.8"%Test
41
+
"org.scalatest"%%"scalatest"%"3.2.11"%Test
42
42
43
43
```
44
44
45
45
The first three lines of this file are essentially the same as the first example, and the `libraryDependencies` lines tell sbt to include the dependencies (jar files) that are needed to run ScalaTest:
46
46
47
47
```scala
48
48
libraryDependencies +=
49
-
"org.scalatest"%%"scalatest"%"3.0.8"%Test
49
+
"org.scalatest"%%"scalatest"%"3.2.11"%Test
50
50
```
51
51
52
52
>The ScalaTest documentation has always been good, and you can always find the up to date information on what those lines should look like on the [Installing ScalaTest](http://www.scalatest.org/install) page.
@@ -84,8 +84,8 @@ There isn’t much that can go wrong with that source code, but it provides a si
84
84
[warn] consider launching sbt without any commands, or explicitly passing 'shell'
85
85
...
86
86
...
87
-
[info] Compiling 1 Scala source to /Users/al/Projects/Scala/HelloScalaTest/target/scala-2.12/classes...
88
-
[info] Running simpletest.Hello
87
+
[info] compiling 1 Scala source to /Users/al/Projects/Scala/HelloScalaTest/target/scala-2.13/classes...
88
+
[info] running simpletest.Hello
89
89
Hello Alvin Alexander
90
90
[success] Total time: 4 s
91
91
````
@@ -107,9 +107,9 @@ Next, create a file named *HelloTests.scala* in that directory with the followin
107
107
```scala
108
108
packagesimpletest
109
109
110
-
importorg.scalatest.FunSuite
110
+
importorg.scalatest.funsuite.AnyFunSuite
111
111
112
-
classHelloTestsextendsFunSuite {
112
+
classHelloTestsextendsAnyFunSuite {
113
113
114
114
// test 1
115
115
test("the name is set correctly in constructor") {
@@ -129,7 +129,7 @@ class HelloTests extends FunSuite {
129
129
130
130
This file demonstrates the ScalaTest `FunSuite` approach. A few important points:
131
131
132
-
- Your class should extend `FunSuite`
132
+
- Your class should extend `AnyFunSuite`
133
133
- You create tests as shown, by giving each `test` a unique name
134
134
- At the end of each test you should call `assert` to test that a condition has been satisfied
135
135
@@ -139,7 +139,7 @@ Now you can run these tests with the `sbt test` command. Skipping the first few
139
139
140
140
````
141
141
> sbt test
142
-
[info] Set current project to HelloScalaTest (in build file:/Users/al/Projects/Scala/HelloScalaTest/)
142
+
[info] set current project to HelloScalaTest (in build file:/Users/al/Projects/Scala/HelloScalaTest/)
0 commit comments