tasty-ant-xml 1.0.5 → 1.1.9
raw patch · 3 files changed
Files
- Changelog.md +88/−0
- Test/Tasty/Runners/AntXML.hs +44/−22
- tasty-ant-xml.cabal +3/−3
Changelog.md view
@@ -1,3 +1,91 @@+# 1.1.9++## Other changes++* Support `tasty-1.5`. Thanks to @sergv (PR #34).++# 1.1.8++## Other Changes++* Support `tasty-1.4`. Due to major API changes, 1.4 is now the minimum version+ of `tasty` supported. Thanks to @jkachmar (PR #31).++# 1.1.7++## Other Changes++* Bump upper bound of `tasty`.++# 1.1.6++## Functionality Changes++* The order of tests is now reversed from what was previously output (which was+ itself reversed). This means that tests are now reported in the order they are+ defined, as expected. Thanks to @feuerbach for this fix. See+ https://github.com/ocharles/tasty-ant-xml/pull/28 for more information.+++# 1.1.5++## Other Changes++* Bump upper bound of `tasty`.+++# 1.1.4++## Other Changes++* Bump upper bound of `tasty`.+++# 1.1.3++## Other Changes++* Bump upper bound of `tasty`.+++# 1.1.2++## Other Changes++* Bump upper bound of `tasty`.+++# 1.1.1++## Other Changes++* Bump upper bound of `tasty`.+++# 1.1.0++## Breaking Changes++* The XML generated is now slightly different in order to satisfy Jenkins. In+ particular:++ * The `classname` attribute now joins the test path with `.` (like a Java+ class name).+ * `testsuite` nodes have a `tests` attribute, which is the amount of tests+ executed.++ For more discussion see https://github.com/ocharles/tasty-ant-xml/pull/20 and+ https://github.com/ocharles/tasty-ant-xml/commit/a01df06b59122c3086fc9f42854129b1d4a8c31c#commitcomment-21211275++ Thanks to @liskin and @haishengwu-okta for this work.++## Other Changes++* Increase the lower bound of `directory` to >= 1.2.3.0. Earlier versions may+ throw exceptions on some of the actions we are using. Thanks to @liskin for+ pointing this out.++ # 1.0.5 ## Other Changes
Test/Tasty/Runners/AntXML.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-}@@ -13,6 +14,8 @@ import Control.Applicative import Control.Arrow (first) import Control.Monad.IO.Class (liftIO)+import Data.Foldable (fold)+import Data.List (intercalate) import Data.Maybe (fromMaybe) import Data.Monoid (Monoid(..), Endo(..), Sum(..)) import Data.Proxy (Proxy(..))@@ -49,12 +52,17 @@ data Summary = Summary { summaryFailures :: Sum Int , summaryErrors :: Sum Int , summarySuccesses :: Sum Int- , xmlRenderer :: Endo XML.Element+ , xmlRenderer :: Endo [XML.Element] } deriving (Generic) instance Monoid Summary where mempty = memptydefault+#if !MIN_VERSION_base(4,11,0) mappend = mappenddefault+#else+instance Semigroup Summary where+ (<>) = mappenddefault+#endif --------------------------------------------------------------------------------@@ -95,12 +103,12 @@ let testCaseAttributes time = map (uncurry XML.Attr . first XML.unqual) [ ("name", testName) , ("time", showTime time)- , ("classname", unwords groupNames)+ , ("classname", intercalate "." (reverse groupNames)) ] mkSummary contents = mempty { xmlRenderer = Endo- (`appendChild` XML.node (XML.unqual "testcase") contents)+ (XML.node (XML.unqual "testcase") contents :) } mkSuccess time = (mkSummary (testCaseAttributes time)) { summarySuccesses = Sum 1 }@@ -129,22 +137,39 @@ Const summary <$ State.modify (+ 1) + runGroup+ :: Reader.MonadReader [String] f+ => String+ -> Tasty.Traversal (Functor.Compose f (Const Summary))+ -> Tasty.Traversal (Functor.Compose f (Const Summary)) runGroup groupName children = Tasty.Traversal $ Functor.Compose $ do- Const soFar <- Reader.withReaderT (++ [groupName]) $ Functor.getCompose $ Tasty.getTraversal children+ Const soFar <- Reader.local (groupName :) $ Functor.getCompose $ Tasty.getTraversal children - let grouped = appEndo (xmlRenderer soFar) $- XML.node (XML.unqual "testsuite") $- XML.Attr (XML.unqual "name") groupName+ let grouped =+ XML.node (XML.unqual "testsuite")+ ([ XML.Attr (XML.unqual "name") groupName+ , XML.Attr (XML.unqual "tests")+ (show . getSum . (summaryFailures `mappend` summaryErrors `mappend` summarySuccesses) $ soFar)+ ]+ , appEndo (xmlRenderer soFar) []+ ) pure $ Const- soFar { xmlRenderer = Endo (`appendChild` grouped)+ soFar { xmlRenderer = Endo (grouped :) } + runGroup' _options groupName =+#if MIN_VERSION_tasty(1, 5, 0)+ runGroup groupName . fold+#else+ runGroup groupName+#endif+ in do (Const summary, tests) <- flip State.runStateT 0 $ flip Reader.runReaderT [] $ Functor.getCompose $ Tasty.getTraversal $ Tasty.foldTestTree- Tasty.trivialFold { Tasty.foldSingle = runTest, Tasty.foldGroup = runGroup }+ Tasty.trivialFold { Tasty.foldSingle = runTest, Tasty.foldGroup = runGroup' } options testTree @@ -152,21 +177,18 @@ createPathDirIfMissing path writeFile path $ XML.showTopElement $- appEndo (xmlRenderer summary) $- XML.node- (XML.unqual "testsuites")- [ XML.Attr (XML.unqual "errors")- (show . getSum . summaryErrors $ summary)- , XML.Attr (XML.unqual "failures")- (show . getSum . summaryFailures $ summary)- , XML.Attr (XML.unqual "tests") (show tests)- , XML.Attr (XML.unqual "time") (showTime elapsedTime)- ]+ XML.node+ (XML.unqual "testsuites")+ ([ XML.Attr (XML.unqual "errors")+ (show . getSum . summaryErrors $ summary)+ , XML.Attr (XML.unqual "failures")+ (show . getSum . summaryFailures $ summary)+ , XML.Attr (XML.unqual "tests") (show tests)+ , XML.Attr (XML.unqual "time") (showTime elapsedTime)+ ]+ , appEndo (xmlRenderer summary) []) return (getSum ((summaryFailures `mappend` summaryErrors) summary) == 0)-- appendChild parent child =- parent { XML.elContent = XML.elContent parent ++ [ XML.Elem child ] } resultException r = case Tasty.resultOutcome r of
tasty-ant-xml.cabal view
@@ -1,5 +1,5 @@ name: tasty-ant-xml-version: 1.0.5+version: 1.1.9 synopsis: Render tasty output to XML for Jenkins description: A tasty ingredient to output test results in XML, using the Ant schema. This XML can be consumed by the Jenkins continuous integration framework. homepage: http://github.com/ocharles/tasty-ant-xml@@ -23,9 +23,9 @@ mtl >= 2.1.2, stm >= 2.4.2, tagged >= 0.7,- tasty >= 0.10 && < 0.12,+ tasty >= 1.4 && < 1.6, transformers >= 0.3.0.0,- directory >= 1.0.0,+ directory >= 1.2.3.0, filepath >= 1.0.0, xml >= 1.3.13 default-language: Haskell98