factor10 / intent

Test framework for Dotty

Home Page:https://factor10.github.io/intent/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intent

Actions Status

Intent is an opinionated test framework for Dotty. It builds on the following principles:

  • Low ceremony test code
  • Uniform test declaration
  • Futures and async testing
  • Arranging test state
  • Fast to run tests

Here is an example on how the tests look:

class StatefulTest extends TestSuite with State[Cart]:
  "an empty cart" using Cart() to :
    "with two items" using (_.add(CartItem("beach-chair", 2))) to :
      "and another three items" using (_.add(CartItem("sunscreen", 3))) to :
        "contains 5 items" in :
          cart => expect(cart.totalQuantity).toEqual(5)

case class CartItem(artNo: String, qty: Int)

case class Cart(items: Seq[CartItem] = Seq.empty):
  def add(item: CartItem): Cart = copy(items = items :+ item)
  def totalQuantity = items.map(_.qty).sum

This readme is focused on building and testing Intent, for documentation on how to use Intent to write tests, see User documentation.

Getting started

Add Intent to your SBT project with the following lines to your build.sbt:

libraryDependencies += "com.factor10" %% "intent" % "0.6.0",
testFrameworks += new TestFramework("intent.sbt.Framework")

Development environment

Intent is an early adopter of Dotty features, which means:

  • You need a recent Dotty (>= 0.25.0-RC1) since Intent use the latest Scala 3 syntax.

  • Visual Studio Code seems to be the best supported editor (although not perfect)

Contributing

See Contributing to Intent

License

Intent is Open Source and released under Apache 2.0. See LICENSE for details.

About

Test framework for Dotty

https://factor10.github.io/intent/

License:Apache License 2.0


Languages

Language:Scala 90.9%Language:CSS 6.2%Language:HTML 2.7%Language:Shell 0.2%