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
In the previous lesson you saw how to write Test-Driven Development (TDD) tests with [ScalaTest](http://www.scalatest.org). ScalaTest also supports a [Behavior-Driven Development (BDD)](https://dannorth.net/introducing-bdd/) style of testing, which we’ll demonstrate next.
18
18
19
-
>This lesson uses the same SBT project as the previous lesson, so you don’t have to go through the initial setup work again.
19
+
>This lesson uses the same sbt project as the previous lesson, so you don’t have to go through the initial setup work again.
20
20
21
21
22
22
@@ -111,9 +111,9 @@ If you want to have a little fun with this, change one or more of the tests so t
111
111
112
112
## Where to go from here
113
113
114
-
For more information about SBT and ScalaTest, see the following resources:
114
+
For more information about sbt and ScalaTest, see the following resources:
115
115
116
-
-[The main SBT documentation](http://www.scala-sbt.org/documentation.html)
116
+
-[The main sbt documentation](http://www.scala-sbt.org/documentation.html)
Copy file name to clipboardExpand all lines: _overviews/scala-book/sbt-scalatest-tdd.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
2
type: section
3
3
layout: multipage-overview
4
-
title: Using ScalaTest with SBT
5
-
description: This lesson shows how to write ScalaTest unit tests with SBT in a test-driven development (TDD) style.
4
+
title: Using ScalaTest with sbt
5
+
description: This lesson shows how to write ScalaTest unit tests with sbt in a test-driven development (TDD) style.
6
6
partof: scala_book
7
7
overview-name: Scala Book
8
8
discourse: true
@@ -13,12 +13,12 @@ next-page: sbt-scalatest-bdd
13
13
---
14
14
15
15
16
-
[ScalaTest](http://www.scalatest.org) is one of the main testing libraries for Scala projects, and in this lesson you’ll see how to create a Scala project that uses ScalaTest. You’ll also be able to compile, test, and run the project with SBT.
16
+
[ScalaTest](http://www.scalatest.org) is one of the main testing libraries for Scala projects, and in this lesson you’ll see how to create a Scala project that uses ScalaTest. You’ll also be able to compile, test, and run the project with sbt.
17
17
18
18
19
19
## Creating the project directory structure
20
20
21
-
As with the previous lesson, create an SBT project directory structure for a project named *HelloScalaTest* with the following commands:
21
+
As with the previous lesson, create an sbt project directory structure for a project named *HelloScalaTest* with the following commands:
22
22
23
23
```sh
24
24
mkdir HelloScalaTest
@@ -43,7 +43,7 @@ libraryDependencies +=
43
43
)
44
44
```
45
45
46
-
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
+
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:
47
47
48
48
```scala
49
49
libraryDependencies +=
@@ -156,7 +156,7 @@ Now you can run these tests with the `sbt test` command. Skipping the first few
156
156
157
157
## TDD tests
158
158
159
-
This example demonstrates a *Test-Driven Development* (TDD) style of testing with ScalaTest. In the next lesson you’ll see how to write *Behavior-Driven Development* (BDD) tests with ScalaTest and SBT.
159
+
This example demonstrates a *Test-Driven Development* (TDD) style of testing with ScalaTest. In the next lesson you’ll see how to write *Behavior-Driven Development* (BDD) tests with ScalaTest and sbt.
160
160
161
161
>Keep the project you just created. You’ll use it again in the next lesson.
Copy file name to clipboardExpand all lines: _overviews/scala-book/scala-build-tool-sbt.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
2
type: section
3
3
layout: multipage-overview
4
-
title: The Scala Build Tool (SBT)
5
-
description: This page provides an introduction to the Scala Build Tool, SBT, including a simple 'Hello, world' project.
4
+
title: The most used scala build tool (sbt)
5
+
description: This page provides an introduction to the Scala Build Tool, sbt, including a simple 'Hello, world' project.
6
6
partof: scala_book
7
7
overview-name: Scala Book
8
8
discourse: true
@@ -14,17 +14,17 @@ next-page: sbt-scalatest-tdd
14
14
15
15
16
16
17
-
You can use several different tools to build your Scala projects, including Ant, Maven, Gradle, and more. But a tool named [SBT](http://www.scala-sbt.org) was the first build tool that was specifically created for Scala, and these days it’s supported by [Lightbend](https://www.lightbend.com), the company that was co-founded by Scala creator Martin Odersky that also maintains Akka, the Play web framework, and more.
17
+
You can use several different tools to build your Scala projects, including Ant, Maven, Gradle, and more. But a tool named [sbt](http://www.scala-sbt.org) was the first build tool that was specifically created for Scala, and these days it’s supported by [Lightbend](https://www.lightbend.com), the company that was co-founded by Scala creator Martin Odersky that also maintains Akka, the Play web framework, and more.
18
18
19
-
>If you haven’t already installed SBT, here’s a link to [its download page](http://www.scala-sbt.org/download.html).
19
+
>If you haven’t already installed sbt, here’s a link to [its download page](http://www.scala-sbt.org/download.html).
20
20
21
21
22
22
23
-
## The SBT directory structure
23
+
## The sbt directory structure
24
24
25
-
Like Maven, SBT uses a standard project directory structure. If you use that standard directory structure you’ll find that it’s relatively simple to build your first projects.
25
+
Like Maven, sbt uses a standard project directory structure. If you use that standard directory structure you’ll find that it’s relatively simple to build your first projects.
26
26
27
-
The first thing to know is that underneath your main project directory, SBT expects a directory structure that looks like this:
27
+
The first thing to know is that underneath your main project directory, sbt expects a directory structure that looks like this:
28
28
29
29
```bash
30
30
build.sbt
@@ -42,9 +42,9 @@ target/
42
42
```
43
43
44
44
45
-
## Creating a “Hello, world” SBT project directory structure
45
+
## Creating a “Hello, world” sbt project directory structure
46
46
47
-
Creating this directory structure is pretty simple, and you can use a shell script like [sbtmkdirs](https://alvinalexander.com/sbtmkdirs) to create new projects. But you don’t have to use that script; assuming that you’re using a Unix/Linux system, you can just use these commands to create your first SBT project directory structure:
47
+
Creating this directory structure is pretty simple, and you can use a shell script like [sbtmkdirs](https://alvinalexander.com/sbtmkdirs) to create new projects. But you don’t have to use that script; assuming that you’re using a Unix/Linux system, you can just use these commands to create your first sbt project directory structure:
48
48
49
49
```bash
50
50
mkdir HelloWorld
@@ -73,7 +73,7 @@ $ find .
73
73
74
74
If you see that, you’re in great shape for the next step.
75
75
76
-
>There are other ways to create the files and directories for an SBT project. One way is to use the `sbt new` command, [which is documented here on scala-sbt.org](http://www.scala-sbt.org/1.x/docs/Hello.html). That approach isn’t shown here because some of the files it creates are more complicated than necessary for an introduction like this.
76
+
>There are other ways to create the files and directories for an sbt project. One way is to use the `sbt new` command, [which is documented here on scala-sbt.org](http://www.scala-sbt.org/1.x/docs/Hello.html). That approach isn’t shown here because some of the files it creates are more complicated than necessary for an introduction like this.
77
77
78
78
79
79
@@ -92,7 +92,7 @@ version := "1.0"
92
92
scalaVersion :="{{ site.scala-version }}"
93
93
```
94
94
95
-
Because SBT projects use a standard directory structure, SBT already knows everything else it needs to know.
95
+
Because sbt projects use a standard directory structure, sbt already knows everything else it needs to know.
96
96
97
97
Now you just need to add a little “Hello, world” program.
Now you can use SBT to compile your project, where in this example, your project consists of that one file. Use the `sbt run` command to compile and run your project. When you do so, you’ll see output that looks like this:
111
+
Now you can use sbt to compile your project, where in this example, your project consists of that one file. Use the `sbt run` command to compile and run your project. When you do so, you’ll see output that looks like this:
112
112
113
113
````
114
114
$ sbt run
@@ -131,7 +131,7 @@ Hello, world
131
131
[success] Total time: 4 s
132
132
````
133
133
134
-
The first time you run `sbt` it needs to download some things and can take a while to run, but after that it gets much faster. As the first comment in that output shows, it’s also faster to run SBT interactively. To do that, first run the `sbt` command by itself:
134
+
The first time you run `sbt` it needs to download some things and can take a while to run, but after that it gets much faster. As the first comment in that output shows, it’s also faster to run sbt interactively. To do that, first run the `sbt` command by itself:
135
135
136
136
````
137
137
> sbt
@@ -150,7 +150,7 @@ Hello, world
150
150
151
151
There, that’s much faster.
152
152
153
-
If you type `help` at the SBT command prompt you’ll see a bunch of other commands you can run. But for now, just type `exit` to leave the SBT shell. You can also press `CTRL-D` instead of typing `exit`.
153
+
If you type `help` at the sbt command prompt you’ll see a bunch of other commands you can run. But for now, just type `exit` to leave the sbt shell. You can also press `CTRL-D` instead of typing `exit`.
0 commit comments