You can use one of the following ways to get Allure:
- Grab it from bintray (see Downloads section).
- Using Homebrew:
brew install allure
- For Windows, Allure is available from the Scoop commandline-installer. To install Allure, download and install Scoop and then execute in the Powershell:
scoop install allure
Add Allure plugin to project
In project/plugin.sbt
file add the next line
addSbtPlugin("io.cronenbergworld" % "allure-zio-plugin" % "<last-version>")
Enable this plugin by adding the next line in build.sbt
file
enablePlugins(AllureAutoPlugin)
import zio.test._
import zio.test.allure.AllureRunnableSpec
import zio.test.allure.Tags._
object ExampleSpec extends AllureRunnableSpec {
def spec = suite("some suite")(
test("failing test") {
val stuff = 1
assert(stuff)(Assertion.equalTo(2))
} @@ owner("ExampleOwner") @@ custom("google.com", "google.com"),
test("failing test 2") {
val stuff = Some(1)
assert(stuff)(Assertion.isSome(Assertion.equalTo(2)))
},
test("failing test 3") {
val stuff = Some(1)
assert(stuff)(Assertion.isSome(Assertion.not(Assertion.equalTo(1))))
},
test("passing test") {
assert(1)(Assertion.equalTo(1))
}
) @@ epic("ExampleEpicName")
}
You need to use zio.test.allure.AllureRunnableSpec
instead of zio.test.DefaultRunnableSpec
If you want to generate report and up the server you need to use
allure serve allure-results
For generate HTML report use
allure generate allure-results