Skip to content

Commit 6e9b524

Browse files
committed
Add Allure report for Scala (sample)
1 parent 0717161 commit 6e9b524

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

build.sbt

+13-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ version := "0.1"
55

66
scalaVersion := "2.13.5"
77

8+
val allureScalaTestVersion = "2.13.3"
9+
10+
resolvers +=
11+
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
12+
13+
814
libraryDependencies += "org.scalatest" %% "scalatest" % "3.3.0-SNAP2" % Test
915
libraryDependencies += "com.github.daddykotex" %% "courier" % "3.0.0-M2a"
1016
libraryDependencies += "com.typesafe" % "config" % "1.4.1"
@@ -16,6 +22,12 @@ libraryDependencies += "org.scalatestplus" %% "selenium-3-141" % "3.2.7.0" % "te
1622
libraryDependencies += "org.scalatest" %% "scalatest-flatspec" % "3.2.7" % "test"
1723
libraryDependencies += "org.scalatest" %% "scalatest-shouldmatchers" % "3.2.7" % "test"
1824
libraryDependencies += "com.google.guava" % "guava" % "30.1.1-jre"
25+
libraryDependencies += "io.qameta.allure" % "allure-scalatest_2.13" % allureScalaTestVersion % Test
26+
1927

28+
enablePlugins(AkkaGrpcPlugin)
2029

21-
enablePlugins(AkkaGrpcPlugin)
30+
testOptions in Test ++= Seq(
31+
Tests.Argument(TestFrameworks.ScalaTest, "-oD"),
32+
Tests.Argument(TestFrameworks.ScalaTest, "-C", "io.qameta.allure.scalatest.AllureScalatest")
33+
)

src/test/scala/email/MailApiTest.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package email
22

33
import com.sun.mail.imap.IdleManager
4+
import io.qameta.allure.scalatest.AllureScalatestContext
45

56
import java.nio.file.Paths
67
import java.util.Properties
@@ -20,14 +21,14 @@ class MailApiTest extends BaseApiTest {
2021
val from: String = config.getString("sender")
2122
val props: Properties = getProperties
2223

23-
"Client" should "be able to send email message" in {
24+
"Client" should "be able to send email message" in new AllureScalatestContext {
2425
val session: Session = getSession(props)
2526

2627
sendEmail(session, from, to, messageSubject, "files/test.txt",
2728
"files/test_attachment.txt")
2829
}
2930

30-
"Client" should "be able to receive email message" in {
31+
"Client" should "be able to receive email message" in new AllureScalatestContext {
3132
val session: Session = getSession(props)
3233

3334
val folder: Folder = openFolderInMailBox(session, folderName)

src/test/scala/ui/BlogTest.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package ui
22

3+
import io.qameta.allure.scalatest.AllureScalatestContext
34
import org.openqa.selenium.chrome.ChromeDriver
45
import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll}
56
import org.scalatest.concurrent.Eventually
@@ -17,7 +18,7 @@ class BlogTest extends AnyFlatSpec with BeforeAndAfterAll with Matchers with Eve
1718
new ChromeDriver()
1819
}
1920

20-
"User" should "be able to view latest blog post" in {
21+
"User" should "be able to view latest blog post" in new AllureScalatestContext {
2122
val homePage = new HomePage
2223
go to homePage
2324
val posts = findAll(CssSelectorQuery("div.post-preview")).toList
@@ -26,7 +27,7 @@ class BlogTest extends AnyFlatSpec with BeforeAndAfterAll with Matchers with Eve
2627
latestPost.text should not be empty
2728
}
2829

29-
"User" should "be able to open Contact Page" in {
30+
"User" should "be able to open Contact Page" in new AllureScalatestContext {
3031
val homePage = new HomePage
3132
go to homePage
3233
homePage.url should equal (currentUrl)
@@ -38,7 +39,7 @@ class BlogTest extends AnyFlatSpec with BeforeAndAfterAll with Matchers with Eve
3839
contactPage.url should equal (currentUrl)
3940
}
4041

41-
"User" should "be able to send message to author" in {
42+
"User" should "be able to send message to author" in new AllureScalatestContext {
4243
val contactPage = new ContactPage
4344
go to contactPage
4445
contactPage.url should be (currentUrl)
@@ -51,7 +52,7 @@ class BlogTest extends AnyFlatSpec with BeforeAndAfterAll with Matchers with Eve
5152
click on cssSelector(contactPage.sendButton)
5253
}
5354

54-
"User" should "be able to open About Page" in {
55+
"User" should "be able to open About Page" in new AllureScalatestContext {
5556
val homePage = new HomePage
5657
go to homePage
5758
homePage.url should equal (currentUrl)

0 commit comments

Comments
 (0)