Popularity
4.9
Declining
Activity
0.0
Stable
1
6
0
Monthly Downloads: 7
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags:
Test
Latest version: v0.1.0
tasty-groundhog-converters alternatives and similar packages
Based on the "Testing" category.
Alternatively, view tasty-groundhog-converters alternatives based on common mentions on social networks and blogs.
-
hedgehog
Release with confidence, state-of-the-art property testing for Haskell. -
DocTest
An implementation of Python's doctest for Haskell -
tasty
Modern and extensible testing framework for Haskell -
quickcheck-state-machine
Test monadic programs using state machine based models -
webdriver
A Haskell client for the Selenium WebDriver protocol. -
curl-runnings
A declarative test framework for quickly and easily writing integration tests against JSON API's. -
smallcheck
Test your Haskell code by exhaustively checking its properties -
ghc-prof-flamegraph
Generates data to be used with flamegraph.pl from .prof files. -
hspec-wai
Helpers to test WAI applications with Hspec -
monad-mock
A Haskell package that provides a monad transformer for mocking mtl-style typeclasses -
checkers
Check properties on standard classes and data structures -
fitspec
refine properties for testing Haskell programs -
hspec-checkers
Allows to use checkers properties from hspec -
test-framework
Framework for running and organising QuickCheck test properties and HUnit test cases -
fuzzcheck
A library for testing monadic code in the spirit of QuickCheck -
hspec-expectations
Catchy combinators for HUnit -
hedgehog-classes
Hedgehog will eat your typeclass bugs -
tasty-hedgehog
Tasty integration for the Hedgehog property testing library -
tasty-discover
Test discovery for the tasty framework. -
leancheck
enumerative property-based testing for Haskell -
hspec-expectations-json
Hspec expectations on JSON Values -
should-not-typecheck
A HUnit/hspec assertion to verify that an expression does not typecheck -
doctest-discover
Easy way to run doctests via cabal -
hspec-golden-aeson
Use tests to monitor changes in Aeson serialization -
quickcheck-arbitrary-adt
Typeclass for generating a list of each instance of a sum type's constructors -
faker
Faker is pure Haskell library for generating fake data. -
type-spec
A tiny EDSL to write type-level-unit tests -
webdriver-w3c
Haskell bindings for the W3C WebDriver API -
swagger-test
Property based testing tool for Swagger APIs -
test-framework-th
Automagically (using Template Haskell) generates the Haskell-code you need when using HUnit -
hspec-jenkins
Jenkins-friendly XML formatter for Hspec -
tasty-rerun
Rerun previous test suite runs to run only failing tests -
markov-chain-usage-model
Computations for Markov chain usage models -
tasty-expected-failure
Mark test cases as expected-failure
Clean code begins in your IDE with SonarLint
Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.
Promo
www.sonarlint.org
Do you think we are missing an alternative of tasty-groundhog-converters or a related project?
README
tasty-groundhog-converters
This library provides a tasty, test harness for groundhog and groundhog-converters.
The key functions are:
roundTripConverter :: Arbitrary a => TestName -> (a -> a -> Bool) -> (Converter a b) -> TestTree
and
goldenSqlConverter :: (PersistEntity b) => TestName -> FilePath -> a -> (b -> b -> Bool) -> Converter a b -> TestTree
Which provide tests for serialization (goldenSqlConverter). and isomorphism (roundTripConverter).
These two together allow a user to quickly add simple testing to a database project using groundhog.
Usage
From the example:
data Group = Group {
_people :: Map Integer Person
}
deriving (Eq)
-- | A wrapped representation of a Person
data Person = Person { _unPerson :: String}
deriving (Eq)
-- | To Build up the converter we have to have an arbitrary instance
instance Arbitrary Person where
arbitrary = Person <$> arbitrary
-- | An Isomorphism between the representation that is pleasent to use in haskell
-- and the one that makes sense to store i.e. 'PersistEntity'
personMapConverter :: Converter (Map Integer Person) [(Int64,String)]
personMapConverter = mapConverter `composeConverter` fmapConverter (bicomposeConverter integerConverter personConverter)
-- | This converter is embedded in 'personMapConverter'
personConverter :: Converter Person String
personConverter = (_unPerson,Person)
-- | A declaration for group.
mkPersist defaultCodegenConfig [groundhog|
- entity: Group
constructors:
- name: Group
fields:
- name: _people
dbName: people
exprName: MappedIdToPerson
converter: personMapConverter
- primitive: Person
converter: personConverter
|]
-- | build a golden test (a single test designed to make sure a representation stays constant over time).
-- The aGroup provided is only used the first time the test is used. The converter at the top level here
-- is just (id, id) and (==) is used because there is an Eq instance on Group.
exampleGoldenSqlConverter :: TestTree
exampleGoldenSqlConverter = goldenSqlConverter "Test The test GoldenSqlConverter" "TestGolden" aGroup (==) (id,id)
where
aGroup = Group somePeople
somePeople = (Map.fromList . zip [1 ..] . fmap Person ) ["Margret"]
-- | There are no database hits on a round trip test
-- Converter makes the claim that a Converter is an Isomorphism between the two DataTypes.
-- Round trip tests should verify this.
exampleRoundTripTest :: TestTree
exampleRoundTripTest = roundTripConverter "roundtrip personMapConverter" (==) personMapConverter
-- | call the example test
tastyTest :: IO ()
tastyTest = defaultMain allTests
where
allTests = testGroup "all example groundhog converter tests" [ exampleGoldenSqlConverter
, exampleRoundTripTest]