简体   繁体   English

如何使用 frisby 运行特定测试?

[英]How to run specific tests with frisby?

We are using frisby to run our integration tests and while developing them, it would be handy to execute one specific one or a group of tests, without having run all of them and see extra noise.我们正在使用 frisby 来运行我们的集成测试,并且在开发它们时,执行一个特定的一个或一组测试会很方便,而无需运行所有测试并看到额外的噪音。 Right now I am commenting out all the ones I don't want to run, which is getting tedious.现在我正在注释掉我不想运行的所有内容,这变得很乏味。

Is there a way, from the command line, to run specific frisby tests?有没有办法从命令行运行特定的 frisby 测试?

So basically, instead of所以基本上,而不是

npm test

I want to be able to say我想说

npm test --name: posts

Or something like that.或类似的东西。 I found this post about jasmine-only, but I'm not sure it will satisfy my needs.我找到了这篇关于 jasmine-only 的帖子,但我不确定它是否能满足我的需求。

Thanks so much!非常感谢!

I'm not sure if you're still looking for answer, but this is pretty simple.我不确定你是否还在寻找答案,但这很简单。

Firstly install latest version of jasmine-node from command line: npm install jasmine-node -g首先从命令行安装最新版本的 jasmine-node: npm install jasmine-node -g

Then to run particular test use: jasmine-node --coffee putTestNameHere然后运行特定的测试使用: jasmine-node --coffee putTestNameHere

Install jasmine-node module.安装 jasmine-node 模块。 Execute one file at a time - you can group your test cases in specific file:一次执行一个文件 - 您可以将测试用例分组到特定文件中:

jasmin-node moduleTestCases_spec.js茉莉节点模块TestCases_spec.js

Also, if you want to specify exact test case name to be executed, you can make use of sequenty module.另外,如果要指定要执行的确切测试用例名称,可以使用 sequenty 模块。 It is a nodejs module, which you can specify the order(and thus the exact test cases to execute).它是一个 nodejs 模块,您可以指定顺序(以及要执行的确切测试用例)。

To run specific test in Frishby just run:要在 Frishby 中运行特定测试,只需运行:

npm test ./folder/filename.js

So lets assume you have an folder say test under that you have a file called api.spec.js then you will execute like this:因此,假设您有一个名为test的文件夹,其中有一个名为api.spec.js的文件,那么您将像这样执行:

npm test ./test/api.spec.js

Parallely don't forget to specify these below things into your package.json file同时不要忘记将以下内容指定到您的package.json文件中

"scripts": {
    "test": "mocha"  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM