Skip to content

Commit

Permalink
=pro akka#15178 enable junit tests in akka-streams again
Browse files Browse the repository at this point in the history
The junit-interface is treating "anything it cannot understand" as a
globbing pattern, thus when it didn't understand ScalaTest options, it
used them for globbing, and of course none of our junit tests matched
the "-oDF" pattern for example.

Debugged this with Stefan and we've opened an issue to improve the
integration in this respect:
sbt/junit-interface#60

Resolves akka#15178
  • Loading branch information
ktoso committed Oct 8, 2014
1 parent 9a560f1 commit 54ffeab
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package akka.stream.actor;

import org.junit.Ignore;
import org.reactivestreams.Publisher;
import org.junit.ClassRule;
import org.junit.Test;
Expand All @@ -17,6 +18,7 @@

import static akka.stream.actor.ActorPublisherMessage.Request;

@Ignore
public class ActorPublisherTest {

@ClassRule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package akka.stream.actor;

import org.junit.Ignore;
import org.reactivestreams.Subscriber;
import org.junit.ClassRule;
import org.junit.Test;
Expand All @@ -19,6 +20,7 @@
import static akka.stream.actor.ActorSubscriberMessage.OnNext;
import static akka.stream.actor.ActorSubscriberMessage.OnError;

@Ignore
public class ActorSubscriberTest {

@ClassRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
Expand All @@ -21,6 +22,7 @@
import akka.stream.testkit.AkkaSpec;
import akka.testkit.JavaTestKit;

@Ignore
public class DuctTest {

@ClassRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import akka.stream.testkit.AkkaSpec;
import akka.testkit.JavaTestKit;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
import org.reactivestreams.Publisher;
import scala.Option;
Expand All @@ -22,6 +23,7 @@

import static org.junit.Assert.assertEquals;

@Ignore
public class FlowTest {

@ClassRule
Expand Down
12 changes: 6 additions & 6 deletions project/AkkaBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -984,16 +984,16 @@ object AkkaBuild extends Build {

// add arguments for tests excluded by tag
testOptions in Test <++= excludeTestTags map { tags =>
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument("-l", tags.mkString(" ")))
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument(TestFrameworks.ScalaTest, "-l", tags.mkString(" ")))
},

// add arguments for running only tests by tag
testOptions in Test <++= onlyTestTags map { tags =>
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument("-n", tags.mkString(" ")))
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument(TestFrameworks.ScalaTest, "-n", tags.mkString(" ")))
},

// show full stack traces and test case durations
testOptions in Test += Tests.Argument("-oDF"),
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),

// don't save test output to a file
testListeners in (Test, test) := Seq(TestLogger(streams.value.log, {_ => streams.value.log }, logBuffered.value)),
Expand Down Expand Up @@ -1411,7 +1411,7 @@ object Dependencies {
val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.2.1" % "test" // ApacheV2
val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "1.0.0" % "test" // ApacheV2
val log4j = "log4j" % "log4j" % "1.2.14" % "test" // ApacheV2
val junitIntf = "com.novocode" % "junit-interface" % "0.10" % "test" // MIT
val junitIntf = "com.novocode" % "junit-interface" % "0.11" % "test" // MIT
// dining hakkers integration test using pax-exam
// mirrored in OSGi sample
val karafExam = "org.apache.karaf.tooling.exam" % "org.apache.karaf.tooling.exam.container" % "2.3.1" % "test" // ApacheV2
Expand Down Expand Up @@ -1473,6 +1473,7 @@ object Dependencies {
"com.typesafe.akka" %% "akka-actor" % Versions.publishedAkkaVersion,
"com.typesafe.akka" %% "akka-persistence-experimental" % Versions.publishedAkkaVersion,
scalaGraph, reactiveStreams,
Test.junitIntf,
Test.scalatest)

val streamTestkit = Seq(
Expand All @@ -1481,12 +1482,11 @@ object Dependencies {
Test.scalatest, Test.scalacheck, Test.junit)

val streamTest = Seq(
Test.scalatest, Test.scalacheck, Test.junit, Test.commonsIo)
Test.scalatest, Test.scalacheck, Test.junit, Test.junitIntf, Test.commonsIo)

val streamTck = Seq(
Test.scalatest, Test.scalacheck, Test.junit, Test.reactiveStreamsTck)


val mailboxes = Seq(Test.scalatest, Test.junit)

val fileMailbox = Seq(Test.commonsIo, Test.scalatest, Test.junit)
Expand Down
3 changes: 2 additions & 1 deletion project/TestExtras.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ object TestExtras {
object JUnitFileReporting {
val settings = Seq(
// we can enable junit-style reports everywhere with this
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-a", "-u", (target.value / "test-reports").getAbsolutePath),
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a"),
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v"),
testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-u", (target.value / "test-reports").getAbsolutePath)
)
}
Expand Down

0 comments on commit 54ffeab

Please sign in to comment.