最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - QuickCheck for Javascript - Stack Overflow

programmeradmin3浏览0评论

Is there a version of quickcheck that works for Javascript and that is well maintained? I have found several such as check.js and claire, but none of them seem to support shrinking of failing test cases, which has always struck me as the most useful part of the whole problem.

Is there a version of quickcheck that works for Javascript and that is well maintained? I have found several such as check.js and claire, but none of them seem to support shrinking of failing test cases, which has always struck me as the most useful part of the whole problem.

Share Improve this question asked May 12, 2014 at 11:39 Zachary KZachary K 3,3351 gold badge30 silver badges36 bronze badges
Add a comment  | 

4 Answers 4

Reset to default 11

I'm creator of jsverify. I'll try constantly to make it better, bug reports and feature requests are welcomed.

There are also a list of other javascript generative testing libraries in a readme. So far I haven't found any other good alternative to the jsverify.

I recently released https://github.com/dubzzz/fast-check

I built it in order to answer several limitations I encountered in the existing quickcheck implementations in JavaScript.

It comes natively with a shrink feature which can shrink even combination of arbitraries (the frameworks I tried were failing on oneof like arbitraries). It also can generate large objects and arrays. By default it tends to try smaller values first in order to detect trivial edge cases while it covers all the possible inputs in next runs. Lots of other features are on-going or already available :)

Cheers, Nicolas

I wrote quick_check.js, which has a nice library of generators. Shrinking is not there yet, but is planned.

There seems to be a dearth of good quickcheck-like testing tools in javascript. However they are to be better supported in typed languages, and in fact you can write your tests in one of those languages if you wish.

To avoid dealing with runtime interop, I'd recommend going with a language which compiles to JS and runs on node.js (eg: Purescript with purescript-quickcheck), or a java-based language using the Nashorn engine provided in Java 8, for example ScalaCheck. You could even use ghcjs and the original flavor of the quickcheck library!

发布评论

评论列表(0)

  1. 暂无评论