Coder Social home page Coder Social logo

haskell / test-framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from batterseapower/test-framework

25.0 13.0 22.0 385 KB

Framework for running and organising QuickCheck test properties and HUnit test cases

Home Page: http://hackage.haskell.org/package/test-framework

Haskell 100.00%
haskell testing

test-framework's People

Contributors

23skidoo avatar andreasabel avatar batterseapower avatar bergmark avatar bos avatar chris-martin avatar ddssff avatar elvishjerricco avatar enolan avatar erikd avatar fuuzetsu avatar gcross avatar glguy avatar gregorycollins avatar hvr avatar mpilgrem avatar orlitzky avatar paul-rouse avatar peti avatar phadej avatar rrnewton avatar ryanglscott avatar serras avatar simonmichael avatar sjakobi avatar sol avatar tibbe avatar trskop avatar unkindpartition avatar ysangkok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

test-framework's Issues

Surprising behaviour of buildTestBracketed

Suppose we we something like

main = defaultMain [testA, testB]

where testA is constructed with buildTestBracketed. If we run the test suite using

test-suite -t testB

then the IO actions of testA will still be executed.

Option to disable progress bar

The progress bar is messing up the logs in Travis. Maybe could we disable the progress bar when running in a pseudo terminal, either by environment detection or by explicit option.

I'd be happy to help :)

Does not support new QuickCheck 2.7.*

test-framework depends on QuickCheck < 2.7, so there are no issues with the build.
However, QuickCheck>=2.7 uses a new random generator tf-random.
https://github.com/nick8325/quickcheck/blob/master/changelog

Bumping the package requirements thus gives the following error;

Test/Framework/Providers/QuickCheck2.hs:73:41:
    Couldn't match expected type `Test.QuickCheck.Random.QCGen'
                with actual type `System.Random.StdGen'
    In the expression: gen
    In the first argument of `Just', namely `(gen, 0)'
    In the `replay' field of a record

newSeededStdGen (that triggers the error above) from test-framework depends on System.Random.StdGen, so test-framework-quickcheck2 needs to implement its own function that may or may not depend on QCGen depending on the QC version.

Enable compilation with latest compiler and/or Stack environment

To my best knowledge the "test-framework" cannot be build with the latest ghc compiler and/or Stack environment.

Background:
My plan was to receive sample data output from QuickCheck2. QuickCheck is capable to do so - but not QuickCheck2 - because the needed parameters cannot be passed. In order to achieve that I tried to modify QuickCheck2. Since, I work with The Haskell Stack and the newest environment - I got stuck.

Please, help

Code details:
https://github.com/JoergBrueggmann/Test6

Question: stop tests on first failure (--fail-fast)

What's the best way to cancel the test runner on the first failure (like bash's -e/-o errexit)? Is it even possible?

I looked in RunnerOptions, but I didn't find it here.

In my case, the Tests are actually HUnit Tests which are IO actions (-> shelltestrunner).

I can't even just use die or fail in the IO action because the test runner continues on error:

image

I'd be glad if an experienced Haskeller could give me a hint!

Support GHC 8.8.1

I could install test-framework 0.8.2.0 with GHC 8.8.1 by running

$ cabal install test-framework --allow-newer=regex-posix

That is, I could install the library by using regex-posix 0.96.0.0. Could someone make the following revision in Hackage please

regex-posix (>=0.72 && <0.96) -> regex-posix (>=0.72 && <0.97)

Blocking agda/agda#3725.

Increasing test case value results in no tests at all

Using the flag -a you can change the number of test cases that should run for each test. The default is 100 tests.

$ dist/build/qc/qc 
Utils:
  refragment id: [OK, passed 100 tests]
...

Now with increased number of test cases;

 dist/build/qc/qc -a 1000
Utils:
  refragment id: [OK, passed 1000 tests]
...

However, if I use more than 1000 test cases, test-framework somehow decides to not run any tests at all.

$ dist/build/qc/qc -a 1001
Utils:
  refragment id: [Failed]
Arguments exhausted after 0 tests
...

As the comment notes, the arguments are exhausted so it's unable to execute any of the tests.

New release upload needed for GHC HEAD/7.10

Currently test-framework-0.8.0.3 does not build with GHC HEAD due to a missing Applicative instance (which was added as per 0dac7f3)

Current master builds w/ GHC HEAD though; moreover, all previously uploaded test-framework packages need their cabal file edited to constrain base <4.8 as they're now known to be incompatible w/ base-4.8

Bump ansi-terminal version upper bound

Just let you know that the latest version of ansi-terminal is 0.10.

It does not seem that it introduces any breaking change, so it should be fine to bump up.

Compatibility with QuickCheck-2.12

Now that QuickCheck-2.12 has been released, it would be handy to have a version of test-framework-quickcheck2 which supported it. Currently, trying to bump the upper version bounds on QuickCheck will lead to a build failure:

[1 of 1] Compiling Test.Framework.Providers.QuickCheck2 ( Test/Framework/Providers/QuickCheck2.hs, /home/rgscott/Documents/Hacking/Haskell/test-framework/dist-newstyle/build/x86_64-linux/ghc-8.4.3/test-framework-quickcheck2-0.3.0.4/build/Test/Framework/Providers/QuickCheck2.o )

Test/Framework/Providers/QuickCheck2.hs:131:23: error:
    Not in scope: data constructor ‘InsufficientCoverage’
    |
131 |     toPropertyStatus (InsufficientCoverage _ _ _)              = PropertyInsufficientCoverage
    |                       ^^^^^^^^^^^^^^^^^^^^

This can be worked around easily enough:

diff --git a/quickcheck2/Test/Framework/Providers/QuickCheck2.hs b/quickcheck2/Test/Framework/Provi
index b61b808..6109400 100644
--- a/quickcheck2/Test/Framework/Providers/QuickCheck2.hs
+++ b/quickcheck2/Test/Framework/Providers/QuickCheck2.hs
@@ -127,6 +127,6 @@ runProperty topts testable = do
     toPropertyStatus (GaveUp {})                               = PropertyArgumentsExhausted
     toPropertyStatus (Failure { reason = rsn, output = otpt }) = PropertyFalsifiable rsn otpt
     toPropertyStatus (NoExpectedFailure {})                    = PropertyNoExpectedFailure
-#if MIN_VERSION_QuickCheck(2,8,0)
+#if MIN_VERSION_QuickCheck(2,8,0) && !MIN_VERSION_QuickCheck(2,12,0)
     toPropertyStatus (InsufficientCoverage _ _ _)              = PropertyInsufficientCoverage
 #endif

But if we do this, then PropertyInsufficientCoverage becomes unused when test-framework-quickcheck2 is built against QuickCheck-2.12. Should we CPP out PropertyInsufficientCoverage as well with QuickCheck-2.12 (since it's already conditionally defined on MIN_VERSION_QuickCheck(2,8,0) anyway)?

print something, even before the test result is known

For long-running tests, it is convenient to learn which test is running even before one knows any results of the test. The console runner does not print anything until the full result is known. The following code demonstrates this:

{-# LANGUAGE MultiParamTypeClasses #-}

import Control.Concurrent
import Control.Monad
import Data.Typeable
import System.IO.Unsafe
import Test.Framework.Runners.Console
import Test.Framework.Providers.API

instance TestResultlike () Bool where testSucceeded = id
instance Testlike       () Bool (IO a) where
  runTest _ act = do
    v <- unsafeInterleaveIO act
    return (Improving () (v `seq` Finished True), return ())
  testTypeName _ = "IO action"

main = defaultMain [Test "infinity" (forever (threadDelay 1000000) >> return ())]

When I run this program, I would like to see at least:

infinity:

but instead see no output.

Deprecate in favor of tasty?

This package is on life support for at least five years and requires regular bumps from Hackage trustees to be compatible with the latest ecosystem. It's only a matter of time when revisions would no longer be enough. I'd like to mark it deprecated in favor of tasty (since migration from test-framework to tasty is mostly a matter of changing imports) to give a clear signal to clients that it's time to move on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.