I like property based testing and it helped me a lot in the past. It’s a great tool for certain domains and with a good setup it could allow more people to contribute.
Having said that, the first part of the article mentions how sales and marketing would rarely contribute to testing, and the very first example starts with using regexes, which are hard even for programmers. Wouldn’t it be easier (yet longer) to implement it with strategy that selects from several other, simpler strategies?
Thanks for sharing! I thought it would be important to give the context from which I approached property-based testing, and the article is mostly an intro for programmers in the field already, hence discussion around corporate and inter-departmental psychology. I believe hypothesis has strategies.characters() which generates a stream of individual characters, but if you want strings I think the only option is st.from_regex(). I might be wrong though. You definitely can chain multiple strategies together.
I like property based testing and it helped me a lot in the past. It’s a great tool for certain domains and with a good setup it could allow more people to contribute.
Having said that, the first part of the article mentions how sales and marketing would rarely contribute to testing, and the very first example starts with using regexes, which are hard even for programmers. Wouldn’t it be easier (yet longer) to implement it with strategy that selects from several other, simpler strategies?
Thanks for sharing! I thought it would be important to give the context from which I approached property-based testing, and the article is mostly an intro for programmers in the field already, hence discussion around corporate and inter-departmental psychology. I believe
hypothesis
hasstrategies.characters()
which generates a stream of individual characters, but if you want strings I think the only option isst.from_regex()
. I might be wrong though. You definitely can chain multiple strategies together.There’s a
text
strategy: https://hypothesis.readthedocs.io/en/latest/data.html#hypothesis.strategies.text