0
0
Testing Fundamentalstesting~10 mins

Database migration testing in Testing Fundamentals - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if the new database schema has the expected table.

Testing Fundamentals
assert '[1]' in new_db.get_tables()
Drag options to blanks, or click blank then click option'
Aconnect
Busers
Cmigrate
Drollback
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names instead of table names.
Forgetting to put the table name as a string.
2fill in blank
medium

Complete the code to verify the row count matches before and after migration.

Testing Fundamentals
assert old_db.count_rows('orders') [1] new_db.count_rows('orders')
Drag options to blanks, or click blank then click option'
A!=
B<
C>
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using inequality operators which would fail the test.
Confusing greater than or less than operators.
3fill in blank
hard

Fix the error in the assertion that checks if a column exists in the migrated table.

Testing Fundamentals
assert '[1]' in new_db.get_columns('customers')
Drag options to blanks, or click blank then click option'
Acustomers
Bget_columns
Ccustomer_id
Dassert
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names or table names instead of column names.
Using keywords like 'assert' in place of column names.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps table names to their row counts after migration.

Testing Fundamentals
row_counts = {table: new_db.[1](table) for table in new_db.[2]()}
Drag options to blanks, or click blank then click option'
Acount_rows
Bget_tables
Ctables
Dfetch_rows
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names that do not exist.
Using variable names instead of method calls.
5fill in blank
hard

Fill all three blanks to filter migrated tables with more than 1000 rows and create a summary dictionary.

Testing Fundamentals
summary = {tbl: new_db.[1](tbl) for tbl in new_db.[2]() if new_db.[3](tbl) > 1000}
Drag options to blanks, or click blank then click option'
Acount_rows
Bget_tables
Dfetch_data
Attempts:
3 left
💡 Hint
Common Mistakes
Using different methods for counting rows in blanks 1 and 3.
Using a method that does not return tables for blank 2.