testing

Testing tools, testing philosophy & methodology...
fabrao 2019-05-17T15:10:10.067700Z

Hello all, about generative testing, what is the best way to generate bunch of string with id like "prefix-" and random string with fixed size, like "prefix-12345"?

dharrigan 2019-05-17T15:29:37.067900Z

(gen/sample (gen/fmap #(apply str "prefix-" %) (gen/vector gen/char-alpha 10)) 10)

dharrigan 2019-05-17T15:29:55.068100Z

("prefix-ZdcwIbtOmG" "prefix-ZWFWPnzpIc" "prefix-WxCRVcrErI" "prefix-toADesqefK" "prefix-dxbcfmdopi" "prefix-sKjscpYcGO" "prefix-MAUqsOYoIu" "prefix-AKJsCWkXca" "prefix-twnWfFkkLv" "prefix-LDqwqRYQbu")

dharrigan 2019-05-17T15:29:58.068300Z

hope that helps! 🙂

fabrao 2019-05-17T15:35:59.068800Z

@dharrigan What is the lib did you use?

dharrigan 2019-05-17T15:36:33.069Z

[org.clojure/test.check "0.9.0"]

fabrao 2019-05-17T15:36:52.069300Z

thanks a lot

dharrigan 2019-05-17T15:37:28.069900Z

(:require [clojure.test.check.generators :as gen])

dharrigan 2019-05-17T15:37:31.070100Z

you're very welcome

dharrigan 2019-05-17T15:37:49.070300Z

https://github.com/clojure/test.check

dharrigan 2019-05-17T15:38:20.070600Z

https://clojure.github.io/test.check/intro.html

dharrigan 2019-05-17T15:38:20.070800Z

.