Skip to main content
20 events
when toggle format what by license comment
Jan 14, 2017 at 8:41 comment added Karol @EricLipper: If you think that your test may fail for some inputs, why do you want to avoid finding those inputs? Answer to your question is: store somewhere the seed of Random and allow to execute test with given seed.
Jan 14, 2017 at 7:22 history tweeted twitter.com/StackCodeReview/status/820169092544024576
Jan 14, 2017 at 6:46 comment added Ebbs @EricLippert what would the point of mocking frameworks be? When you mock objects using them they generate random data. You are right from the traditional point of view of testing, however I feel that the point of tests should be for them to find problems in your code you don't know of and don't anticipate, instead of only writing tests for problems you suspect might occur. In my case I record each set of test data and their results so I can see exactly what produced an outlier bug so I can address it as soon as it occurs.
Jan 13, 2017 at 21:35 comment added Eric Lippert Randomizing tests is a bad idea. Suppose a test fails one time in a million; how are you going to be able to reproduce it to find the problem? Generate your random data once and hard code it into the tests.
Jan 13, 2017 at 20:09 comment added CodesInChaos This code is not thread-safe.
Jan 13, 2017 at 19:56 comment added Ebbs @radarbob I forgot to add that I am not using or hitting a real DB in my tests either. I am rather generating the tables I need in memory from my EF models. This random string class is part of the routine of seeding those tables.
Jan 13, 2017 at 19:41 vote accept Ebbs
Jan 13, 2017 at 19:37 comment added Ebbs The intention of these random strings are purely to add some form of realism to the integration tests I've built to ensure that characters I would normally not think of from my English speak perspective won't unintentionally break my code. Maybe this can be seen as showing a lack of knowledge in my chosen platform, however I approach it from the point of view of completeness in my tests. Also, These random strings are not be not used in a security scenario as generating "random" passwords, but purely for testing purposes.
Jan 13, 2017 at 16:25 answer added Peilonrayz timeline score: 3
Jan 13, 2017 at 15:16 answer added Nikita B timeline score: 4
Jan 13, 2017 at 14:55 comment added radarbob Retorical question: How valid are these tests; any given test? How can random input on every test run be covering the intended conditions? Unless test output results are being compared. But that sounds like a test dependency that should be avoided. If this is unit testing, we don't want to use a database precisely because of its variable/uncontrolled state.
Jan 13, 2017 at 14:52 comment added Denis Why do you need random strings ?
Jan 13, 2017 at 14:41 answer added CharlesNRice timeline score: 9
Jan 13, 2017 at 14:22 history edited t3chb0t
edited tags
Jan 13, 2017 at 14:20 answer added t3chb0t timeline score: 16
Jan 13, 2017 at 14:19 history edited forsvarir CC BY-SA 3.0
Typo
Jan 13, 2017 at 14:15 history edited BCdotWEB CC BY-SA 3.0
edited body
Jan 13, 2017 at 14:14 history edited t3chb0t CC BY-SA 3.0
removed thanks in advance and improved the title
Jan 13, 2017 at 14:12 review First posts
Jan 13, 2017 at 14:19
Jan 13, 2017 at 14:09 history asked Ebbs CC BY-SA 3.0