Databricks Certified Data Engineer Professional — Question 177
A Data Engineer wants to run unit tests using common Python testing frameworks on Python functions defined across several Databricks notebooks currently used in production.
How can the data engineer run unit tests against functions that work with data in production?
Answer options
- A. Define and import unit test functions from a separate Databricks notebook
- B. Define and unit test functions using Files in Repos
- C. Run unit tests against non-production data that closely mirrors production
- D. Define unit tests and functions within the same notebook
Correct answer: B
Explanation
The correct answer is B because using Files in Repos allows for better version control and organization of testing code, which is essential when dealing with production notebooks. Option A does not provide the same structure as Repos, and C is not ideal for testing the functions as it doesn't ensure that the tests are validated against production scenarios. Option D lacks separation of concerns, making it harder to manage tests independently from production code.