Testing with Sbt - no tests found

420 views Asked by At

I'm trying to build up a project for Android using Scaloid and some test platform (I tried ScalaTest and ScalaCheck), but when I enter in sbt "test" or "testOnly *" - it behaves like I do not have any tests in my project. What is even more weird that if I try to put some gibberish into StringSpecification.scala - it still compiles, giving me a tip that this scala file is not included in the test build.

Here is my build.sbt and my test: https://gist.github.com/archeg/e5618c52f5661f494418

My project structure is next:

wlan-client/
| -- src/
|    |-- scaloid.powerwlan/ #- my sources
|
| -- test/
|    |-- src/
|    |    | -- StringSpecification.scala
|    |    | -- My other tests....
|
| -- build.sbt

My sources and my tests are put in not standard folders, but I have refleted that in my build.sbt

I have just started with both Scaloid and Sbt, so it's probably something simple I forgot or did wrong.

If it is any importance I also trying to run this under IntelliJ Idea, but running only over sbt console is fine as long as IntelliJ Idea can check the syntax I'm writing.


Finally did it! I have no idea why it works, so if anybody could explain it to me, I will count this as an answer:

What I did is created folder tests (with s in the end), put it under wlan-client. Then I put debugIncludesTests in Android := false in build.sbt according to this thread: https://github.com/pfn/android-sdk-plugin/issues/45 and I also removed my directory mappings from build.sbt

I understand why I need debugIncludesTests variable, but I have no idea why tests folder works - it does not follow the convention, and why other folders don't work?

1

There are 1 answers

1
Gangstead On

The convention is to put tests in src/test/scala. You just have them in test/src