Bug 15160 - GetTopIssues.t should create random data
Summary: GetTopIssues.t should create random data
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Chris Cormack
QA Contact: Galen Charlton
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-09 14:35 UTC by Tomás Cohen Arazi
Modified: 2016-06-21 21:40 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 15160: GetTopIssues.t should create random data (5.31 KB, patch)
2015-11-09 14:42 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 15160: GetTopIssues.t should create random data (5.42 KB, patch)
2015-11-10 09:03 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 15160: GetTopIssues.t should create random data (5.49 KB, patch)
2015-11-10 10:02 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2015-11-09 14:35:58 UTC
GetTopIssues.t currently creates fixed-value objects on the DB. If the id's it tries to use already exist on the DB it would fail.

TestBuilder should take care of that.
Comment 1 Tomás Cohen Arazi 2015-11-09 14:42:30 UTC Comment hidden (obsolete)
Comment 2 Frédéric Demians 2015-11-10 09:03:14 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2015-11-10 10:02:07 UTC
Created attachment 44687 [details] [review]
Bug 15160: GetTopIssues.t should create random data

This patch refactors t/db_dependent/Circulation/GetTopIssues.t so it
creates its own data with random values. It does so by replacing (legacy)
SQL inserts and fixed value data inserting by TestBuilder generated data.

There is no expected behaviour change.

To test:
- Create an itemtyp directly on your DB with GTI_I_TEST as its itemtype
  > INSERT INTO itemtypes (itemtype) VALUES ('GTI_I_TEST');
- Run:
  $ prove t/db_dependent/Circulation/GetTopIssues.t
=> FAIL: The insert line fails
- Apply the patch
- Run:
  $ prove t/db_dependent/Circulation/GetTopIssues.t
=> SUCCESS: tests pass due to random data usage.
- Sign off

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
  Test plan produces the expected result, failing, then OK.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Tomás Cohen Arazi 2015-11-10 12:49:34 UTC
Patch pushed to master.