TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Feedback on project idea (automated regression test generation)

2 pointsby syskover 10 years ago
I&#x27;ve noticed that when I write Javascript tests (and am in a rush), I often just call a bunch of functions with (semi-)randomly chosen arguments, check what return values &#x2F; changed state I get and codify that in a test suite using asserts so that when I want to refactor later I can catch some bugs. It&#x27;s obviously not the ideal way to write tests but it&#x27;s better than nothing.<p>I was wondering if I could automate the process by writing a tool that would extract all exported functions from a module, call them with randomly generated arguments and save return values and&#x2F;or changed state. The tool could then generate a test suite using that information. The tool could also be used to quickly add tests to third party libraries.<p>Of course this tool would generate &quot;dumb&quot; tests with raw data but the intent here is not to offer an alternative to human written tests but rather to offer an alternative to no tests at all.<p>The concept could be applied to other languages as well.<p>Does such a tool already exist?<p>Am I overlooking some critical issue?<p>Do you think such a tool would be useful?

1 comment

S4Mover 10 years ago
There is something called quick_check.js [0] that looks similar to what you want. It&#x27;s inspired by Haskell&#x27;s QuickCheck library [1].<p>[0] <a href="https://github.com/gampleman/quick_check.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gampleman&#x2F;quick_check.js</a><p>[1] <a href="https://wiki.haskell.org/Introduction_to_QuickCheck1" rel="nofollow">https:&#x2F;&#x2F;wiki.haskell.org&#x2F;Introduction_to_QuickCheck1</a>