选择使用Hspec和堆栈运行哪个测试 [英] Select which test to run with Hspec and stack

查看:142
本文介绍了选择使用Hspec和堆栈运行哪个测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用自动规范发现功能编写了一系列测试Hspec。我还使用堆栈作为我的构建工具。



我的测试目录包含 Spec.hs 文件,以及我的应用程序的不同模块的测试文件(例如 Module0Spec.hs Module1Spec.hs )。



现在,当我开始编写新的测试模块,或者当我想在代码更改后重新运行失败的测试时,我希望只能运行给定的测试模块。



<有没有什么方法可以让Stack或Hspec做到这一点? 我找到了答案这里。我试着用 - ,但是我需要使用 - test-arguments

  stack test --test-arguments-mModule0


I've written a series of test, using the automatic spec discovery feature of Hspec. I'm also using stack as my build tool.

My test directory has the the Spec.hs file, along with the test files for the different modules of my application (e.g. Module0Spec.hs, Module1Spec.hs).

Now, when I start writing a new test module, or when I want to re-run a failed test after code changes, I'd like to be able to run only a given test module.

Is there any way in which either stack or Hspec allow to do this?

解决方案

I found the answer here. I was trying with --, however I needed to use --test-arguments:

stack test --test-arguments "-m "Module0""

这篇关于选择使用Hspec和堆栈运行哪个测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆