Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaschmid/sbt-test-notifier
Plugin for simple-build-tool (sbt) to show a visual notification of the test results.
https://github.com/aaschmid/sbt-test-notifier
Last synced: 19 days ago
JSON representation
Plugin for simple-build-tool (sbt) to show a visual notification of the test results.
- Host: GitHub
- URL: https://github.com/aaschmid/sbt-test-notifier
- Owner: aaschmid
- License: apache-2.0
- Created: 2011-01-23T17:44:11.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-03-05T09:37:01.000Z (over 13 years ago)
- Last Synced: 2024-10-12T11:13:49.840Z (about 1 month ago)
- Language: Scala
- Homepage:
- Size: 1000 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
sbt-test-notifier
=================This is a customizable plugin for [simple-build-tool](http://code.google.com/p/simple-build-tool/)
to show a visual notification containing the test results.Requirements
------------* Sbt version 0.7.x (not compatible with 0.5.x series).
* A library to display a notification, e.g.
([libnotify-bin](https://launchpad.net/ubuntu/maverick/+package/libnotify-bin)
for Ubuntu with Gnome)Usage
-----**ATTENTION:** This will just work if you download the source, build it by your own and
use `publish-local` to publish it to your local repository. ;)
But I am working on it.To use this plugin you have change `/project/plugins/Plugins.scala`:
import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
// lazy val sbtTestNotifierRepository = "sbt-test-notifier-repo" at "???"
lazy val sbtIdea = "de.aaschmid.sbtplugin" % "sbt-test-notifier" % "0.1"// ...
}Afterwards you have to `import de.aaschmid.sbtplugin.testnotifier.TestNotify` and add it
to the project class in `/project/Project.scala`, e.g.:import sbt._
class Project(info: ProjectInfo) extends DefaultProject(info) with TestNotify {
// ...
}Customizations
--------------There are a lot possible customizations that are described in this section.
### Notification
The displaying of notifications is done by executing a shell command using a
`ProcessBuilder` and its method `!`. This is highly dependent on the operating
system such that you can configure it according to your operating system.
Currently it just works for Ubuntu with Gnome by using
[notify-send](http://manpages.ubuntu.com/manpages/maverick/man1/notify-send.1.html)
from the [libnotify-bin](https://launchpad.net/ubuntu/maverick/+package/libnotify-bin)
package. On Debian/Ubuntu this can be installed using
[apt-get](http://manpages.ubuntu.com/manpages/maverick/en/man8/apt-get.8.html).sudo apt-get install libnotify-bin
If anyone does the customizations for a specific operating system with a certain
library, I would be glad to get your code to add it to the plugin. One has to
overridedef notificationCommand: String
and
def notificationParams(worst: Severity, summary: String, body: String): List[String]
Furthermore the time how long a notification is shown can be set by
`def notificationTime: Int` using in milliseconds. But be aware that this will not work
if you use [notify-send](http://manpages.ubuntu.com/manpages/maverick/man1/notify-send.1.html)
from [libnotify-bin](https://launchpad.net/ubuntu/maverick/+package/libnotify-bin) which is
the default right now.### Message
The message header/summary can be adjusted by overriding, e.g.:
def summary(worst: Severity): String = "Test " + worst
The message body can be changed completely within
`def body(duration: Long, testResults: List[TestResult]): String` or by
changing the result of one of this methods:* `def formatDuration(millies: Long): String`
* `def formatPassed(tests: List[TestResult]): String`
* `def formatSkipped(tests: List[TestResult]): String`
* `def formatFailed(tests: List[TestResult]): String`
* `def formatErrors(tests: List[TestResult]): String`or the more generally
`def formatTestResults(prefix: String, tests: List[TestResult], showTestClasses: Boolean): String`.### Icons
The default images are copied from the `jar` package to the projects `target/`
directory on demand. The directory can e.g. set to the `/tmp/` byoverride def imageTargetDir: File =
new File(System.getProperty("java.io.tmpdir"))If you want to use your own icons you can just set them for every severity in method
def icon(s: Severity): File
### Console
If you do not want to get the notification message also be printed on the console
you can set `def printNotification: Boolean` to `false`.Contributors
------------* [Eric Weikl](https://github.com/ericweikl)
* [Andreas Schmid](https://github.com/aaschmid)