From 803330337789a10bd2693844361305f668df1e61 Mon Sep 17 00:00:00 2001 From: Ches Martin Date: Fri, 23 Jan 2015 20:07:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Use=20sbt=E2=80=99s=20Maven-style=20integra?= =?UTF-8?q?tion=20test=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://www.scala-sbt.org/release/docs/Testing.html#Integration+Tests Since the specs2 tag stuff had been commented out anyway, this is mainly to make it simpler for people (and CI) to run unit tests only. With less reliance on test framework-specific features and remembering to add tags, it’s hopefully easier to maintain too. --- README.md | 12 +++++++----- build.sbt | 8 ++++++-- src/{test => it}/resources/application.conf | 0 src/{test => it}/scala/ClientIntegrationSpec.scala | 4 +--- 4 files changed, 14 insertions(+), 10 deletions(-) rename src/{test => it}/resources/application.conf (100%) rename src/{test => it}/scala/ClientIntegrationSpec.scala (98%) diff --git a/README.md b/README.md index 9fd3453..8b6af52 100644 --- a/README.md +++ b/README.md @@ -145,14 +145,16 @@ adapters with optional deps. ## Hack On It +Unit tests can be run with the standard SBT commands `test`, `testQuick`, etc. + The test suite includes integration tests which require keys and access to Keen -IO's API. You can skip them in the SBT console with: +IO's API. If you have set keys through environment variables or configuration as +described above, you may run these with: -``` -> testOnly * -- exclude integration -``` + $ sbt it:test -Unit tests can be run with the standard SBT `test`, `testQuick`, etc. +**Only use a dedicated dummy account for this purpose, data could be destroyed +that you didn't expect!** [Keen IO]: http://keen.io/ diff --git a/build.sbt b/build.sbt index 9bd7df7..9e67b50 100644 --- a/build.sbt +++ b/build.sbt @@ -30,8 +30,8 @@ libraryDependencies ++= { "io.spray" %% "spray-util" % sprayVersion, "net.databinder.dispatch" %% "dispatch-core" % "0.11.2", "org.clapper" %% "grizzled-slf4j" % "1.0.2", - "org.specs2" %% "specs2" % "2.4.13" % "test", - "org.slf4j" % "slf4j-simple" % "1.7.6" % "test" + "org.specs2" %% "specs2" % "2.4.13" % "it,test", + "org.slf4j" % "slf4j-simple" % "1.7.6" % "it,test" ) } @@ -41,3 +41,7 @@ initialCommands in console := "import io.keen.client.scala._" // ...but skip it in case we've broken the build and want the REPL to find out why! initialCommands in consoleQuick := "" +// SBT support for Maven-style integration tests (src/it) +Defaults.itSettings +configs(IntegrationTest) + diff --git a/src/test/resources/application.conf b/src/it/resources/application.conf similarity index 100% rename from src/test/resources/application.conf rename to src/it/resources/application.conf diff --git a/src/test/scala/ClientIntegrationSpec.scala b/src/it/scala/ClientIntegrationSpec.scala similarity index 98% rename from src/test/scala/ClientIntegrationSpec.scala rename to src/it/scala/ClientIntegrationSpec.scala index fa1f0de..3c6ffce 100644 --- a/src/test/scala/ClientIntegrationSpec.scala +++ b/src/it/scala/ClientIntegrationSpec.scala @@ -14,8 +14,6 @@ class ClientIntegrationSpec extends Specification with NoTimeConversions { // slow--see IntegrationPatience in ScalaTest, not sure if specs2 has similar... val timeout = 4.seconds - // args(exclude = "integration") - sequential // This set of expectations currently assumes master access. Should @@ -175,5 +173,5 @@ class ClientIntegrationSpec extends Specification with NoTimeConversions { client.shutdown() 1 must beEqualTo(1) } - } section("integration") + } } From d38e99a3c4a5aff7bb8a474191bb118fbb243f75 Mon Sep 17 00:00:00 2001 From: Ches Martin Date: Fri, 23 Jan 2015 20:31:44 +0800 Subject: [PATCH 2/2] Add Travis config and badge By default Travis will run the following, for the Scala versions set in the YAML. $ sbt ++$TRAVIS_SCALA_VERSION test So that is only unit tests, which for the moment is what we want, until something fancy is sorted out to run integration tests against a dummy account. --- .travis.yml | 8 ++++++++ README.md | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d840395 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: scala +scala: + - 2.11.2 + - 2.10.4 +jdk: + - oraclejdk7 + - openjdk7 + diff --git a/README.md b/README.md index 8b6af52..1e977d8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # KeenClient-Scala +[![Build Status]](https://travis-ci.org/keenlabs/KeenClient-Scala) + The official asynchronous Scala client for the [Keen IO] API. **Note**: This library is in early development and does not implement all of the @@ -157,6 +159,7 @@ described above, you may run these with: that you didn't expect!** +[Build Status]: https://travis-ci.org/keenlabs/KeenClient-Scala.svg?branch=master [Keen IO]: http://keen.io/ [Semantic Versioning]: http://semver.org/ [the changelog]: https://github.com/keenlabs/KeenClient-Scala/blob/master/CHANGELOG