Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cats testkit based on other testing frameworks? #2244

Closed
LukaJCB opened this issue May 4, 2018 · 13 comments
Closed

Cats testkit based on other testing frameworks? #2244

LukaJCB opened this issue May 4, 2018 · 13 comments

Comments

@LukaJCB
Copy link
Member

LukaJCB commented May 4, 2018

Right now our cats testkit is based on ScalaTest, personally I don't really like that testing library all that much, so it'd be great if we could offer an alternative that's just as integrated for law testing.
I think Monix/minitest would be a good candidate to get this going :) what do you think?

@tpolecat
Copy link
Member

tpolecat commented May 4, 2018

I'm not a fan of any existing test framework at this point because all of them are side-effecting, but I would definitely prefer something lighter like minitest.

@kailuowang
Copy link
Contributor

kailuowang commented May 4, 2018

I am curious what people would need from the cats-testkit if they are using minitest. In mainecoon I am using ScalaTest and I don't even need cats-testkit. I think the main feature of cats-testkit is a test base so that you don't have to write import cats.implicits._ in your ScalaTest.

@tpolecat
Copy link
Member

tpolecat commented May 4, 2018

The main feature is setting up law-checking, which isn't even remotely obvious. Also providing a combination of deps that work together. This stuff was always a nightmare in scalaz.

@LukaJCB
Copy link
Member Author

LukaJCB commented May 4, 2018

It also comes with discipline integration so you can do checkAll for law tests, which is really the main reason I do it, tbh

@kailuowang
Copy link
Contributor

kailuowang commented May 4, 2018

discipline comes with cats-laws, you don't need cats-testkit. You can do law-checking without cats-testkit.

@kailuowang
Copy link
Contributor

maybe we should update the documentation to make this less confusing.

@tpolecat
Copy link
Member

tpolecat commented May 4, 2018

As far as I can tell there is exactly zero doc for discipline so I don't consider it something we can expect people to use directly. So yeah maybe we could fix that.

@ChristopherDavenport
Copy link
Member

A better guide for discipline would be extremely useful. As without it being easy to put into place unlawful instances will likely proliferate outside of libraries that have overcome that entry-barrier.

@kailuowang
Copy link
Contributor

Discipline comes with two tiny parts.
One is to help define hierarchical laws
https://github.com/typelevel/discipline/blob/master/shared/src/main/scala/Laws.scala
The other part is two helpers to generate ScalaTest and Spec2 tests using laws - i.e. the checkAll thing.
The ScalaTest one is like three lines

  def checkAll(name: String, ruleSet: Laws#RuleSet): Unit = {
    for ((id, prop)  ruleSet.all.properties)
      test(name + "." + id) {
        check(prop)
      }
  }

I guess what we really need is to provide checkAlls for other test frameworks inside discipline.

@kailuowang
Copy link
Contributor

kailuowang commented May 4, 2018

I am modifying the documentation.
update: PR submitted
#2245

@ghost
Copy link

ghost commented May 23, 2018

Catalysts provides all of this, and has done so for a few years. And was based on work done in cats, spire, algebra, shapeless, etc.

Its fine if folk decide on another solution, but we may well be going round in circles here.

@ghost
Copy link

ghost commented May 23, 2018

Btw, maybe not obvious, but discipline is well documented in the scaladoc.

@LukaJCB
Copy link
Member Author

LukaJCB commented Oct 1, 2018

Picking this up, should we provide cats-testkit-spec2 and cats-testkit-minitest modules that depend on those two testing frameworks instead of ScalaTest? :)

@LukaJCB LukaJCB closed this as completed May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants