---
title: "How to run a single test in SBT"
description: "Why testOnly does not work?"
author: "Bartosz Mikulski"
author_bio: "Principal AI Engineer & MLOps Architect. I bridge the gap between \"it works in a notebook\" and \"it works for 200 million users.\""
author_url: https://mikulskibartosz.name
author_linkedin: https://www.linkedin.com/in/mikulskibartosz/
author_github: https://github.com/mikulskibartosz
canonical_url: https://mikulskibartosz.name/how-to-run-a-single-test-in-sbt
---

Note to self. Maybe one day I will finally remember how to run **a single test class in sbt**. Currently, I must google that every time I need it.

When you want to run tests from a single test class using the **command line** (not from the sbt interactive mode), you probably write this:

```
sbt testOnly name.mikulskibartosz.TestClass
```

**This is wrong!** It runs all of the tests.

The correct way of running a single test class looks like this:

```
sbt "testOnly name.mikulskibartosz.TestClass"
```

Please remember about the quotation.