簡體   English   中英

Haskell Test.Framework 指定從命令行運行的測試數量

[英]Haskell Test.Framework specify number of tests to run from command line

文檔暗示Test.Framework可以使用命令行參數運行。 有一個函數defaultMain :: [Test] -> IO ()還有一個函數defaultMainWithOpts :: [Test] -> RunnerOptions -> IO ()這是

defaultMain一個版本,它允許您忽略命令行參數,轉而使用一組顯式的RunnerOptions

我找不到有關如何傳遞命令行參數的文檔,並且無法識別選項的錯誤消息僅顯示“無法識別的選項”。 所以我的問題是如何在運行cabal test時傳遞從命令行運行的cabal test

defaultMainWithOpts不適用於命令行:它忽略並禁止所有命令行選項。 要在命令行上進行測試,您應該使用defaultMain並且--help會告訴您所有可用的選項,例如:

Usage: cc-test [OPTIONS]
                   --help                                       show this help message
  -j NUMBER        --threads=NUMBER                             number of threads to use to run tests
                   --test-seed=NUMBER|random                    default seed for test random number generator
  -a NUMBER        --maximum-generated-tests=NUMBER             how many automated tests something like QuickCheck should try, by default
                   --maximum-unsuitable-generated-tests=NUMBER  how many unsuitable candidate tests something like QuickCheck should endure before giving up, by default
  -s NUMBER        --maximum-test-size=NUMBER                   to what size something like QuickCheck should test the properties, by default
  -d NUMBER        --maximum-test-depth=NUMBER                  to what depth something like SmallCheck should test the properties, by default
  -o NUMBER        --timeout=NUMBER                             how many seconds a test should be run for before giving up, by default
                   --no-timeout                                 specifies that tests should be run without a timeout, by default
  -l               --list-tests                                 list available tests but don't run any; useful to guide subsequent --select-tests
  -t TEST-PATTERN  --select-tests=TEST-PATTERN                  only tests that match at least one glob pattern given by an instance of this argument will be run
                   --jxml=FILE                                  write a JUnit XML summary of the output to FILE
                   --jxml-nested                                use nested testsuites to represent groups in JUnit XML (not standards compliant)
                   --plain                                      do not use any ANSI terminal features to display the test run
                   --color                                      use ANSI terminal features to display the test run
                   --hide-successes                             hide sucessful tests, and only show failures

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM