Re: [sbt] Running tests with sbt

969 views
Skip to first unread message

Martin Grigorov

unread,
Jul 12, 2012, 3:35:35 AM7/12/12
to simple-b...@googlegroups.com
Hi,

Try by adding
testOptions in Test := Seq(Tests.Filter(s => s.endsWith("Test")))

in your config. This instructs SBT to recognize all .scala files which
names end with **Test to be used as test files.

On Thu, Jul 12, 2012 at 5:25 AM, popprem <pop...@gmail.com> wrote:
> Hi,
>
> I'm new to sbt and i'm using sbt-0.11.3 version. When i run "test" command,
> i can see it shows 57 test classes compiled, but says no tests to run. The
> test classes uses SpringJUnit4ClassRunner. And also i need jetty up to run
> some tests which are integration tests. I have imported all the tests to
> eclipse and executed them correctly, but nothing is getting executed from
> sbt. Please advice me on
>
> How to run these tests
> How to run integration tests with jetty up
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "simple-build-tool" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/simple-build-tool/-/_MtCD4THriIJ.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to
> simple-build-t...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/simple-build-tool?hl=en.

Mark Harrah

unread,
Jul 12, 2012, 7:31:12 AM7/12/12
to simple-b...@googlegroups.com
On Thu, 12 Jul 2012 10:35:35 +0300
Martin Grigorov <martin....@gmail.com> wrote:

> Hi,
>
> Try by adding
> testOptions in Test := Seq(Tests.Filter(s => s.endsWith("Test")))
>
> in your config. This instructs SBT to recognize all .scala files which
> names end with **Test to be used as test files.

This is only a filter on what sbt has already recognized as a test.

> On Thu, Jul 12, 2012 at 5:25 AM, popprem <pop...@gmail.com> wrote:
> > Hi,
> >
> > I'm new to sbt and i'm using sbt-0.11.3 version. When i run "test" command,
> > i can see it shows 57 test classes compiled, but says no tests to run. The
> > test classes uses SpringJUnit4ClassRunner. And also i need jetty up to run
> > some tests which are integration tests. I have imported all the tests to
> > eclipse and executed them correctly, but nothing is getting executed from
> > sbt. Please advice me on
> >
> > How to run these tests

See the Testing page:

https://github.com/harrah/xsbt/wiki/Testing

In particular, see the junit-interface, which enables support for junit tests:

https://github.com/szeiger/junit-interface

> > How to run integration tests with jetty up

Discussed recently in:

https://groups.google.com/d/topic/simple-build-tool/-p-sXX0QXJI/discussion

-Mark

> > Thanks.

Heiko Seeberger

unread,
Jul 28, 2012, 11:19:16 AM7/28/12
to simple-b...@googlegroups.com
On Jul 27, 2012, at 10:19 PM, JUL wrote:

> Same here. JUnit tests in java are compiled, and the .class can be seen in target/test-classes. But they are not executed, nor listed when executing "show defined-tests".

Everything is src/test/java or src/test/scala is compiled by default when running test:compile which runs first when you run test.

In order to make execute your tests, please read https://github.com/szeiger/junit-interface

Heiko

daoyuana...@gmail.com

unread,
Apr 15, 2014, 10:29:41 PM4/15/14
to simple-b...@googlegroups.com
Same here. I just switched to another git branch and those test written in ScalaTest can no longer run, nor in `show defined-tests`.
Reply all
Reply to author
Forward
0 new messages