Request: scalacheck with effectful properties

Aperta
#372 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
15/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
scala
Ambito
testing

Direzione di ricerca

This is an open design discussion, not a defined change. The payload names no files. It mentions the scalacheck integration, where properties must be pure, and a proposed forall variant that takes an IO[Expectations] body. Read the existing scalacheck integration to see how properties are run, then settle the design in the thread. Done means an agreed API and a per-run logger approach, which a maintainer has to decide first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I'm using weaver + scalacheck, where my properties are actually IO programs that I evaluate with TestControl.executeEmbed(fullTask).unsafeRunSync().

The IO is part of the interface I'm testing, but in tests I'm injecting nonblocking dependencies (i.e. an in-memory stub KV store instead of a real DB). So everything is actually synchronous, but the interface still needs to be IO.

This seems like a bit of a gap with the current scalacheck integration, where properties must be pure. Perhaps I'm stretching the definition of a property, but all I really want to do is run a program and make assertions over an array of different generated inputs. TBH even if the properties involved real IO, using scalacheck still seems valid and useful (even if it's potentially slow / expensive compared to pure properties).

One concrete issues I have is that my properties include logging. Unfortunately, they all share the same logger, so when e.g. example 80 fails, I get the logs for 79 successful tests and one failed test.

So, creating an issue to track/discuss support for IO in scalacheck properties. Features I'd like:

  • a version of forall where the body/property returns IO[Expectations]
    • potentially using the IO monad's parallelism, instead of (or as well as?) scalacheck's parallelism
  • a separate logger per run, so only the failed run's logs are printed
Lingua principale
Scala
Stelle
87
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di typelevel/weaver-test

Tutte le issue di typelevel/weaver-test

Issue simili

Altre issue su Scala

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.