Problem
- Maintainers and developers are confused about varying positive test assertion counts for patches passing tests.
Goal
- Ensure that assertion counts can be trusted.
Details
- Running the same test suite on the same machine can yield a difference of hundreds assertions.
- The difference is caused by various tests that use
rand(1, 10)for their initial setup (which means that test assertions are exponentially increasing for each additional item).
Solution
- Remove all calls to
rand()from all tests.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | d7-1560028.diff | 2.03 KB | thehong |
| #9 | drupal8.tests-rand.9.patch | 1.91 KB | sun |
| #4 | 1560028.patch | 1.82 KB | bleen |
| #1 | 1560028.patch | 1.82 KB | bleen |
Comments
Comment #1
bleen commentedIncidentally, we should not remove *all* calls to rand() (or mt_rand()) from simpletests as most of them are used to set a random weight, languagecode, chr, etc... We only need to remove those calls that case an inconsistent number of assertions.
In fact, I only found three places where rand() is used in such a way that there are random assertions.
Comment #2
sunAwesome, thanks!
Comment #4
bleen commentedthis should fix that errr
Comment #5
bleen commentedhere testbot .. here boy
Comment #6
sunComment #7
sun#4: 1560028.patch queued for re-testing.
Comment #9
sunComment #10
dries commentedCommitted to 8.x. Thanks!
Comment #11
thehong commentedComment #12
sunThanks @thehong! :)
Comment #13
David_Rothstein commentedCommitted to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/e0961c9