Bug 391 - Incorrect result of Database test case as duplicate record exists
Summary: Incorrect result of Database test case as duplicate record exists
Status: RESOLVED FIXED
Alias: None
Product: online shop management system
Classification: Unclassified
Component: Database (show other bugs)
Version: 1.0.0
Hardware: PC Windows
: High major
Assignee: gkpcheung3-c
URL:
Depends on:
Blocks:
 
Reported: 2020-11-06 00:08 HKT by gkpcheung3-c
Modified: 2020-11-06 00:42 HKT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gkpcheung3-c 2020-11-06 00:08:33 HKT
Multiple test cases that test ProductTypeDB, SalesProductDB and UserDB return unexpected result. Test cases that involve using the record in different databases. Duplicate records were found in different databases.
Comment 1 gkpcheung3-c 2020-11-06 00:32:52 HKT
Using one of the test cases "test_getTotalIncome" as an example of the step:
1. Define Product p1, p2, p3.
2. Add p1, p2, p3 into the product database.
3. Calculate the expected total income of the product.
4. Calculate the actual total income of the product using the product database.
5. Compare the expected total income (from step 3) with the actual total income (from step 4).
Comment 2 gkpcheung3-c 2020-11-06 00:42:50 HKT
The bugs fixed successfully after setting the setup() method of the class testDB with clearing the database. As each test case in testDB will run setup() when running the test cases, if the database does not clear at the beginning, the record will keep increasing and duplicated. As a result, the result of the test case will be affected.