### Scala Object Methods Source: https://www.scalatest.org/scaladoc/1.6.1/org/scalatest/matchers/Matchers%24StartWithWord Overview of common methods available on Scala objects, inherited from AnyRef and Any. These methods provide core functionalities for object comparison, identification, and string representation. ```Scala def != (arg0: AnyRef): Boolean def ## (): Int def == (arg0: AnyRef): Boolean def clone (): AnyRef def eq (arg0: AnyRef): Boolean def equals (arg0: Any): Boolean def finalize (): Unit def getClass (): java.lang.Class[_] def hashCode (): Int def ne (arg0: AnyRef): Boolean def notify (): Unit def notifyAll (): Unit def synchronized [T0] (arg0: => T0): T0 def toString (): String def wait (): Unit def wait (arg0: Long, arg1: Int): Unit def wait (arg0: Long): Unit ``` -------------------------------- ### ScalaTest JUnit3Suite Example Source: https://www.scalatest.org/scaladoc/plus-junit-4.13/3.2.8.0/org/scalatestplus/junit/JUnit3Suite An example of a ScalaTest JUnit3Suite demonstrating test methods, fixture setup, and the use of both JUnit and ScalaTest assertions. Tests are methods starting with 'test' and fixtures are managed via 'setUp' and 'tearDown'. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/words/StartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Scala JUnit3Suite Example Source: https://www.scalatest.org/scaladoc/plus-junit-4.13/3.2.14.0/org/scalatestplus/junit/JUnit3Suite An example of a ScalaTest JUnit3Suite demonstrating test methods, fixture setup, and the use of both JUnit and ScalaTest assertions. Tests are methods starting with 'test' and fixtures are managed via 'setUp' and 'tearDown'. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/Matcher%24AndStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### ScalaTest JUnit3Suite Example Source: https://www.scalatest.org/scaladoc/plus-junit-4.12/3.2.1.0/org/scalatestplus/junit/JUnit3Suite An example of a ScalaTest JUnit3Suite demonstrating test methods, fixture setup, and the use of both JUnit and ScalaTest assertions. Tests are methods starting with 'test' and fixtures are managed via 'setUp' and 'tearDown'. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/Matchers%24ResultOfStartWithWordForString Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### ScalaTest JUnit3Suite Example Source: https://www.scalatest.org/scaladoc/plus-junit-4.13/3.2.13.0/org/scalatestplus/junit/JUnit3Suite An example demonstrating how to use JUnit3Suite in ScalaTest. It shows setting up fixtures with `setUp` and defining tests with methods starting with 'test', using both JUnit and ScalaTest assertions. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### Scala JUnit3Suite Example Source: https://www.scalatest.org/scaladoc/plus-junit-4.12/3.2.0.0/org/scalatestplus/junit/JUnit3Suite An example of a ScalaTest JUnit3Suite demonstrating test methods, fixture setup, and the use of both JUnit and ScalaTest assertions. Tests are methods starting with 'test' and returning Unit. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory5%24AndStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### SuiteStarting Event Methods (Product) Source: https://www.scalatest.org/scaladoc/1.5.1/org/scalatest/events/SuiteStarting Details the methods inherited from the Product trait for the SuiteStarting event, including productArity, productElement, productElements, productIterator, and productPrefix. ```Scala def productArity: Int def productElement(arg0: Int): Any def productElements: Iterator[Any] // deprecated: use productIterator instead def productIterator: Iterator[Any] def productPrefix: String ``` -------------------------------- ### JUnit3Suite Example (Scala) Source: https://www.scalatest.org/scaladoc/plus-junit-4.12/3.1.1.0/org/scalatestplus/junit/index Provides an example of a `JUnit3Suite`, which is a ScalaTest `Suite` that also extends `junit.framework.TestCase`. Tests are defined as methods starting with 'test', and fixtures can be managed using `setUp` and `tearDown`. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory5%24OrStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### JUnit3Suite Example (Scala) Source: https://www.scalatest.org/scaladoc/3.0.5/org/scalatest/junit/index Provides an example of a `JUnit3Suite`, which is a ScalaTest `Suite` that also extends `junit.framework.TestCase`. Tests are defined as methods starting with 'test', and fixtures can be managed using `setUp` and `tearDown`. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory7%24AndStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### ScalaTest: Setup with BeforeAndAfter Source: https://www.scalatest.org/getting_started_with_fun_suite This Scala code demonstrates how to use the `BeforeAndAfter` trait in ScalaTest to execute setup code before each test. It initializes a mutable stack for testing stack operations. ```Scala import org.scalatest.funsuite.AnyFunSuite import org.scalatest.BeforeAndAfter import scala.collection.mutable.Stack class ExampleSuite extends AnyFunSuite with BeforeAndAfter { var stack: Stack[Int] = _ before { stack = new Stack[Int] } test("pop is invoked on a non-empty stack") { stack.push(1) stack.push(2) val oldSize = stack.size val result = stack.pop() assert(result === 2) assert(stack.size === oldSize - 1) } test("pop is invoked on an empty stack") { intercept[NoSuchElementException] { stack.pop() } assert(stack.isEmpty) } } ``` -------------------------------- ### JUnit3Suite Example (Scala) Source: https://www.scalatest.org/scaladoc/plus-junit-4.12/3.1.2.0/org/scalatestplus/junit/index Provides an example of a `JUnit3Suite`, which is a ScalaTest `Suite` that also extends `junit.framework.TestCase`. Tests are defined as methods starting with 'test', and fixtures can be managed using `setUp` and `tearDown`. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory1%24AndStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### JUnit3Suite Example (Scala) Source: https://www.scalatest.org/scaladoc/plus-junit-4.12/3.1.0.0/org/scalatestplus/junit/index Provides an example of a `JUnit3Suite`, which is a ScalaTest `Suite` that also extends `junit.framework.TestCase`. Tests are defined as methods starting with 'test', and fixtures can be managed using `setUp` and `tearDown`. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory6%24OrStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory3%24AndStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### ScalaTest JUnit3Suite with JUnit Assertions Source: https://www.scalatest.org/scaladoc/1.7.1/org/scalatest/junit/JUnit3Suite Example of a ScalaTest JUnit3Suite using standard JUnit 3 style assertions. It demonstrates fixture setup with `setUp` and defines tests using methods starting with 'test'. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp() { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy() { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun() { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory7%24OrStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Scala Exception Interception with Assertion Source: https://www.scalatest.org/getting_started_with_fun_suite An example of using `intercept` to catch an exception and then asserting properties of the caught exception object. ```Scala val s = "hi" val thrown = intercept[IndexOutOfBoundsException] { s.charAt(-1) } assert(thrown.getMessage === "String index out of range: -1") ``` -------------------------------- ### Implement Basic Object Methods in Scala Source: https://www.scalatest.org/scaladoc/1.4.1/org/scalatest/matchers/Matchers%24MatcherWrapper%24AndStartWithWord Illustrates the implementation of basic object methods in Scala, including `equals`, `hashCode`, `toString`, and `getClass`. These methods are inherited from AnyRef and provide core functionality for object representation and comparison. ```Scala def equals (arg0: Any): Boolean def hashCode (): Int def toString (): String def getClass (): java.lang.Class[_] ``` -------------------------------- ### ScalaTest: Compile and Run Example Source: https://www.scalatest.org/getting_started_with_fun_suite This shell command sequence shows how to compile and run a ScalaTest suite. It includes the necessary classpath for the scalatest library. ```Shell $ scalac -cp scalatest-3.2.19.jar ExampleSuite.scala $ scala -cp scalatest-3.2.19.jar org.scalatest.run ExampleSuite ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory3%24OrStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Get Query String Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24ClassNameQuery Returns the query string for this query. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### Scala JUnit3Suite with JUnit Assertions Source: https://www.scalatest.org/scaladoc/1.5.1/org/scalatest/junit/JUnit3Suite An example of a ScalaTest JUnit3Suite using JUnit-style assertions. It demonstrates fixture management with setUp() and defines test methods starting with 'test'. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp() { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy() { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun() { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory1%24OrStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### ScalaTest JUnit3Suite with JUnit Assertions Source: https://www.scalatest.org/scaladoc/1.5/org/scalatest/junit/JUnit3Suite An example of a JUnit3Suite using standard JUnit 3 assertions for testing. It demonstrates fixture setup and test methods that start with 'test'. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp() { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy() { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun() { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory2%24OrStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### JUnit3Suite Example (Scala) Source: https://www.scalatest.org/scaladoc/3.0.8/org/scalatest/junit/index Provides an example of using JUnit3Suite, a ScalaTest Suite that extends JUnit 3's TestCase. This allows tests to be run by both JUnit 3 and ScalaTest runners, using methods starting with 'test' and fixture methods like 'setUp' and 'tearDown'. ```Scala import org.scalatest.junit.JUnit3Suite import scala.collection.mutable.ListBuffer class BlastFromThePastSuite extends JUnit3Suite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ override def setUp(): Unit = { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } def testEasy(): Unit = { // Uses JUnit-style assertions sb.append("easy!") assertEquals("ScalaTest is easy!", sb.toString) assertTrue(lb.isEmpty) lb += "sweet" } def testFun(): Unit = { // Uses ScalaTest assertions sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } } ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory8%24AndStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory4%24AndStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Get Query String Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24TagNameQuery Returns the query string associated with this query. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### Get Query String Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24TagNameQuery Retrieves the query string associated with this query. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory8%24OrStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/matchers/MatcherFactory4%24OrStartWithWord Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Get Query String Property Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24PartialLinkTextQuery Returns the query string for this query. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/events/SuiteStarting Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Get Query String with ScalaTest Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24PartialLinkTextQuery Retrieves the query string for this query. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### ScalaTest TestStarting: Basic Methods Source: https://www.scalatest.org/scaladoc/1.6.1/org/scalatest/events/TestStarting Includes fundamental methods inherited from AnyRef and Any, such as hashCode, clone, and getClass, which are common to all Scala objects. ```Scala def ## (): Int def clone (): AnyRef def getClass (): java.lang.Class[_] def hashCode (): Int ``` -------------------------------- ### Get Query String Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24NameQuery Returns the query string used for this query. For example, the query string for `id("q")` is `"q"`. ```Scala val queryString: String ``` -------------------------------- ### Get Query String Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24LinkTextQuery Returns the query string representation of the query. For example, the query string for `id("q")` is `"q"`. ```Scala val queryString: String ``` -------------------------------- ### ScalaTest TestStarting: Basic Methods Source: https://www.scalatest.org/scaladoc/1.7.2/org/scalatest/events/TestStarting Includes fundamental methods inherited from AnyRef and Any, such as hashCode, clone, and getClass, which are common to all Scala objects. ```Scala def ## (): Int def clone (): AnyRef def getClass (): java.lang.Class[_] def hashCode (): Int ``` -------------------------------- ### Get Query String Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24CssSelectorQuery Returns the query string representation of the selector. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### ScalaTest TestStarting: Basic Methods Source: https://www.scalatest.org/scaladoc/1.7.1/org/scalatest/events/TestStarting Includes fundamental methods inherited from AnyRef and Any, such as hashCode, clone, and getClass, which are common to all Scala objects. ```Scala def ## (): Int def clone (): AnyRef def getClass (): java.lang.Class[_] def hashCode (): Int ``` -------------------------------- ### ScalaTest TestStarting: Basic Methods Source: https://www.scalatest.org/scaladoc/1.4.1/org/scalatest/events/TestStarting Includes fundamental methods inherited from AnyRef and Any, such as hashCode, clone, and getClass, which are common to all Scala objects. ```Scala def ## (): Int def clone (): AnyRef def getClass (): java.lang.Class[_] def hashCode (): Int ``` -------------------------------- ### Get Query String Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24CssSelectorQuery Retrieves the query string associated with this query. For example, the query string for `id("q")` is `"q"`. ```Scala val queryString: String ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/events/TestStarting Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Scala Assertion Example (ScalaTest ===) Source: https://www.scalatest.org/getting_started_with_fun_suite Demonstrates ScalaTest's `===` operator for assertions, which provides more detailed error messages compared to the standard `==` operator. ```Scala assert(1 === 2) ``` -------------------------------- ### ScalaTest TestStarting: Basic Methods Source: https://www.scalatest.org/scaladoc/1.8/org/scalatest/events/TestStarting Includes fundamental methods inherited from AnyRef and Any, such as hashCode, clone, and getClass, which are common to all Scala objects. ```Scala def ## (): Int def clone (): AnyRef def getClass (): java.lang.Class[_] def hashCode (): Int ``` -------------------------------- ### Get Query String Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24XPathQuery Returns the query string used for this XPath query. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/events/RunStarting Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Get Query String in Scala Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24IdQuery Retrieves the query string associated with this query. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/prop/Configuration%24MinSize Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### Scala Assertion Example (Standard) Source: https://www.scalatest.org/getting_started_with_fun_suite Illustrates a basic Scala assertion using the standard equality operator `==`. This will result in a less informative error message upon failure. ```Scala assert(1 == 2) ``` -------------------------------- ### Get Query String for XPathQuery Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24XPathQuery Returns the raw query string used by the XPathQuery. For example, the query string for id("q") is "q". ```Scala val queryString: String ``` -------------------------------- ### Report TestStarting Event in Scala Source: https://www.scalatest.org/scaladoc/1.7.2/org/scalatest/events/TestStarting This snippet demonstrates how to report a `TestStarting` event in ScalaTest. It shows the creation of a `TestStarting` instance with necessary parameters and passing it to a report function. This is useful for custom reporters or integrating with testing frameworks. ```Scala report(TestStarting(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName)) ``` -------------------------------- ### Get Query String in Scala Source: https://www.scalatest.org/scaladoc/plus-selenium-3.141/3.2.8.0/org/scalatestplus/selenium/WebBrowser%24ClassNameQuery Returns the query string representation of the current query. For example, for id("q"), the query string is "q". ```Scala val queryString: String ``` -------------------------------- ### Scalatest Matchers: StartWithWord Source: https://www.scalatest.org/scaladoc/1.9.1/index/index-r Illustrates the use of the StartWithWord matcher in Scalatest for verifying the beginning of a string. This is available through ClassicMatchers. ```Scala import org.scalatest.matchers.classic.ClassicMatchers class MySpec extends AnyFunSuite with ClassicMatchers { test("string should start with a word") { "hello world" should startWithWord ("hello") } } ``` -------------------------------- ### Scala Exception Interception Example Source: https://www.scalatest.org/getting_started_with_fun_suite Shows how to use ScalaTest's `intercept` method to test for expected exceptions. The code that is expected to throw an exception is placed within curly braces. ```Scala val s = "hi" intercept[IndexOutOfBoundsException] { s.charAt(-1) } ``` -------------------------------- ### Scalatest: Create TestStarting Event Source: https://www.scalatest.org/scaladoc/1.7.2/org/scalatest/events/TestStarting%24 Constructs a TestStarting event with provided suite and test details. This overload allows specifying formatter, rerunner, and payload for detailed test reporting. ```Scala def apply (ordinal: Ordinal, suiteName: String, suiteClassName: Option[String], testName: String, formatter: Option[Formatter], rerunner: Option[Rerunner], payload: Option[Any]): TestStarting Constructs a new `TestStarting` event with the passed parameters, passing the current thread's name as `threadname` and the current time as `timeStamp`. ordinal an `Ordinal` that can be used to place this event in order in the context of other events reported during the same run suiteName the name of the suite containing the test that is starting suiteClassName an optional fully qualifed `Suite` class name containing the test that is starting testName the name of the test that is starting formatter an optional formatter that provides extra information that can be used by reporters in determining how to present this event to the user ``` ```Scala def apply (ordinal: Ordinal, suiteName: String, suiteClassName: Option[String], testName: String, formatter: Option[Formatter], rerunner: Option[Rerunner]): TestStarting Constructs a new `TestStarting` event with the passed parameters, passing `None` as the `payload`, the current threads name as `threadname`, and the current time as `timeStamp`. ordinal an `Ordinal` that can be used to place this event in order in the context of other events reported during the same run suiteName the name of the suite containing the test that is starting suiteClassName an optional fully qualifed `Suite` class name containing the test that is starting testName the name of the test that is starting formatter an optional formatter that provides extra information that can be used by reporters in determining how to present this event to the user rerunner an optional `Rerunner` that can be used to rerun the test that is starting (if `None` is passed, the test cannot be rerun) returns a new `TestStarting` instance initialized with the passed and default values ``` ```Scala def apply (ordinal: Ordinal, suiteName: String, suiteClassName: Option[String], testName: String, formatter: Option[Formatter]): TestStarting Constructs a new `TestStarting` event with the passed parameters, passing `None` as the `rerunner`, `None` as the `payload`, the current threads name as `threadname`, and the current time as `timeStamp`. ordinal an `Ordinal` that can be used to place this event in order in the context of other events reported during the same run suiteName the name of the suite containing the test that is starting suiteClassName an optional fully qualifed `Suite` class name containing the test that is starting testName the name of the test that is starting formatter an optional formatter that provides extra information that can be used by reporters in determining how to present this event to the user returns a new `TestStarting` instance initialized with the passed and default values ``` ```Scala def apply (ordinal: Ordinal, suiteName: String, suiteClassName: Option[String], testName: String): TestStarting Constructs a new `TestStarting` event with the passed parameters, passing `None` for `formatter`, `None` as the `rerunner`, `None` as the `payload`, the current threads name as `threadname`, and the current time as `timeStamp`. Constructs a new `TestStarting` event with the passed parameters, passing `None` for `formatter`, `None` as the `rerunner`, `None` as the `payload`, the current threads name as `threadname`, and the current time as `timeStamp`. ordinal an `Ordinal` that can be used to place this event in order in the context of other events reported during the same run suiteName the name of the suite containing the test that is starting suiteClassName an optional fully qualifed `Suite` class name containing the test that is starting testName the name of the test that is starting returns a new `TestStarting` instance initialized with the passed and default values ``` -------------------------------- ### FixtureContext Example Setup Source: https://www.scalatest.org/scaladoc/3.2.8/org/scalatest/index An example demonstrating the setup for `FixtureContext` in Scalatest, partitioning fixture objects into traits for flexible test configuration. ```Scala package org.scalatest.examples.flatspec.fixturecontext import collection.mutable.ListBuffer import org.scalatest.FlatSpec ``` -------------------------------- ### Scalatest: RunStarting Event Construction (apply) Source: https://www.scalatest.org/scaladoc/1.7.1/org/scalatest/events/RunStarting%24 Documents the 'apply' methods used to construct 'RunStarting' events. These methods allow for the creation of event objects with varying parameters, including test count, configuration map, formatter, and payload. They are crucial for reporting the start of a test run. ```Scala def apply (ordinal: Ordinal, testCount: Int, configMap: Map[String, Any]): RunStarting Constructs a new `RunStarting` event with the passed parameters, passing `None` for `formatter`, `None` as the `payload`, the current threads name as `threadname`, and the current time as `timeStamp`. Constructs a new `RunStarting` event with the passed parameters, passing `None` for `formatter`, `None` as the `payload`, the current threads name as `threadname`, and the current time as `timeStamp`. ordinal an `Ordinal` that can be used to place this event in order in the context of other events reported during the same run testCount the number of tests expected during this run configMap a `Map` of key-value pairs that can be used by custom `Reporter`s returns a new `RunStarting` instance initialized with the passed and default values def apply (ordinal: Ordinal, testCount: Int, configMap: Map[String, Any], formatter: Option[Formatter]): RunStarting Constructs a new `RunStarting` event with the passed parameters, passing `None` as the `payload`, the current threads name as `threadname`, and the current time as `timeStamp`. Constructs a new `RunStarting` event with the passed parameters, passing `None` as the `payload`, the current threads name as `threadname`, and the current time as `timeStamp`. ordinal an `Ordinal` that can be used to place this event in order in the context of other events reported during the same run testCount the number of tests expected during this run configMap a `Map` of key-value pairs that can be used by custom `Reporter`s formatter an optional formatter that provides extra information that can be used by reporters in determining how to present this event to the user returns a new `RunStarting` instance initialized with the passed and default values def apply (ordinal: Ordinal, testCount: Int, configMap: Map[String, Any], formatter: Option[Formatter], payload: Option[Any]): RunStarting Constructs a new `RunStarting` event with the passed parameters, passing the current thread's name as `threadname` and the current time as `timeStamp`. Constructs a new `RunStarting` event with the passed parameters, passing the current thread's name as `threadname` and the current time as `timeStamp`. ordinal an `Ordinal` that can be used to place this event in order in the context of other events reported during the same run testCount the number of tests expected during this run configMap a `Map` of key-value pairs that can be used by custom `Reporter`s formatter an optional formatter that provides extra information that can be used by reporters in determining how to present this event to the user payload an optional object that can be used to pass custom information to the reporter about the `RunStarting` event returns a new `RunStarting` instance initialized with the passed and default values ``` -------------------------------- ### FixtureContext Example Setup Source: https://www.scalatest.org/scaladoc/3.2.8/org/scalatest/index An example demonstrating the setup for `FixtureContext` in Scalatest, partitioning fixture objects into traits for flexible test configuration. ```Scala package org.scalatest.examples.flatspec.fixturecontext import collection.mutable.ListBuffer import org.scalatest.FlatSpec ``` -------------------------------- ### Report TestStarting Event in ScalaTest Source: https://www.scalatest.org/scaladoc/1.5.1/org/scalatest/events/TestStarting This snippet demonstrates how to report a `TestStarting` event in ScalaTest. It shows the creation of a `TestStarting` instance with necessary parameters and passing it to a `report` function. This is useful for custom reporters or test execution frameworks. ```Scala report(TestStarting(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName)) ``` -------------------------------- ### FixtureContext Example Setup Source: https://www.scalatest.org/scaladoc/3.2.7/org/scalatest/index An example demonstrating the setup for `FixtureContext` in Scalatest, partitioning fixture objects into traits for flexible test configuration. ```Scala package org.scalatest.examples.flatspec.fixturecontext import collection.mutable.ListBuffer import org.scalatest.FlatSpec ``` -------------------------------- ### ScalaTest Assertions Example Source: https://www.scalatest.org/scaladoc/2.0/org/scalatest/selenium/WebBrowser%24switch%24 Demonstrates the use of ScalaTest's assertion capabilities, including various matchers and ways to assert conditions. ```Scala import org.scalatest.Assertions._ assert(1 == 1) assert(1 != 2) assert(true) assert(Option(1) === Some(1)) assert(List(1, 2) === List(1, 2)) ``` -------------------------------- ### AnyRef Methods for SuiteStarting Source: https://www.scalatest.org/scaladoc/1.5/org/scalatest/events/SuiteStarting Details common methods inherited from AnyRef, such as toString and wait, applicable to the SuiteStarting event. ```Scala def toString(): String // Returns a string representation of the object. def wait(): Unit def wait(arg0: Long, arg1: Int): Unit def wait(arg0: Long): Unit ``` -------------------------------- ### FixtureContext Example Setup Source: https://www.scalatest.org/scaladoc/3.2.7/org/scalatest/index An example demonstrating the setup for `FixtureContext` in Scalatest, partitioning fixture objects into traits for flexible test configuration. ```Scala package org.scalatest.examples.flatspec.fixturecontext import collection.mutable.ListBuffer import org.scalatest.FlatSpec ``` -------------------------------- ### ScalaTest 'not' Matcher for Negation Source: https://www.scalatest.org/user_guide/using_matchers Shows how to negate conditions using the 'not' matcher in ScalaTest. Examples include checking for non-null values, inequality, and strings that do not start with a specific prefix. ```Scala // Negating conditions with 'not' // result should not be (null) // sum should not be <= (10) // mylist should not equal (yourList) // string should not startWith ("Hello") ```