Request: scalacheck with effectful properties

Abierto
#372 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
15/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
scala
Área
testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Scala
Estrellas
87
Forks
17
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de typelevel/weaver-test

Todos los issues de typelevel/weaver-test

Issues similares

Más issues de Scala

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.