How to integrate scalatest with selenium

scalatest example
scalatest integration test
scalatest trait
selenium testing
scalatest unitspec
install scalatest
scala integration test framework
scalatestplus-selenium

From reading http://www.scalatest.org/user_guide/using_selenium I'm trying to intergrate selenium & scalatest selenium DSL.

Here is the code I'm using :

class BlogSpec extends FlatSpec with ShouldMatchers with Chrome {


    System.setProperty("webdriver.chrome.driver", "C:\\selenium-drivers\\chromedriver.exe"); 
    val host = "http://www.google.com"

    go to (host)
    title should be ("Awesome Blog")

}

But I receive this error :

* RUN ABORTED * java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list at com.google.common.base.Preconditions.checkState(Preconditions.java:176) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:118) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:61) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:107) at org.scalatest.selenium.Chrome$class.$init$(WebBrowser.scala:3756) at BlogSpec.(BlogSpec.scala:12) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) ...

The driver does exist at C:\\selenium-drivers\\chromedriver.exe Am I setting the driver correctly or is there a separate problem in above code ? Chrome is also not starting

I think System.setProperty in the above code gets called only after Chrome is instantiated, meaning after the above error is thrown. Maybe you should try setting the system property using -D.

org.scalatestplus.selenium.WebBrowser, To use ScalaTest's Selenium DSL, mix trait WebBrowser into your test class. of element, whereas enter can only be used on text entry fields, which include:. Java, IntelliJ IDEA, Selenium, Scala, and Eclipse are some of the popular tools that integrate with ScalaTest.Here's a list of all 12 tools that integrate with ScalaTest.

I have used Maven for running automatically ScalaTest Selenium integration tests. I didn't have used the ChromeDriver but the HtmlUnit driver. And with Maven you can also set custom properties by the commandline with "-Dxxx".

Check out: https://bitbucket.org/olimination/hello-scalajava/overview for an example Maven webapp project with Scala/Java.

How to integrate scalatest with selenium, I think System.setProperty in the above code gets called only after Chrome is instantiated, meaning after the above error is thrown. Maybe you� Testing with mock objects. You can use any Java mocking framework with ScalaTest, or ScalaMock, a Scala mocking alternative. ScalaTest provides just enough syntax sugar for the three most popular Java mocking frameworks—JMock, EasyMock, and Mockito—to remove boilerplate and clarify the client code.

alternatively you can try this instead of extending from Chrome

private val chromeDriverPath = "~/Downloads/chromedriver"
System.setProperty("webdriver.chrome.driver", chromeDriverPath)
import Chrome._
`

ScalaWebTest Documentation, In contrast to unit and even integration tests, these are likely to be the most fragile and therefore, the most expensive to maintain. Cucumber vs ScalaTest: What are the differences? Cucumber: Simple, human collaboration. Cucumber is a tool that supports Behaviour-Driven Development (BDD) - a software development process that aims to enhance software quality and reduce maintenance costs; ScalaTest: A testing tool in the Scala ecosystem. You can test Scala, Scala.js

Recording UI Tests Using Scalatest, Selenium and Akka, It can be used from a number of languages - Java, Python, Ruby. Scalatest 2.0 introduced a DSL Duration: 45:33 Posted: Jan 4, 2016 How to integrate ScalaTest (FlatSpec) with Play. GitHub Gist: instantly share code, notes, and snippets.

Using the Scalatest Selenium DSL, Integrating Selenium testing infrastructure into Scala Project. 1. Test Automation Using Selenium Swati Email- swati@knoldus.com; 2. History of� NUnit and ScalaTest belong to "Testing Frameworks" category of the tech stack. ScalaTest is an open source tool with 847 GitHub stars and 271 GitHub forks. Here's a link to ScalaTest's open source repository on GitHub.

Integrating Selenium testing infrastructure into Scala Project, ScalaTest + Selenium provides integration support between ScalaTest and Selenium. - scalatest/scalatestplus-selenium. Using the ScalaTest Maven plugin. The ScalaTest Maven plugin allows you to run ScalaTest tests through Maven without requiring @RunWith(classOf[JUnitRunner]) annotations and access all functionality of the ScalaTest Runner, including parallel execution and multiple reporters.

Comments
  • how is a system propery set using -D ? I cannot find any java reference to it ?