
Databricks Certified Data Engineer - Professional
Get started today
Ultimate access to all questions.
How can a Data Engineer execute unit tests using standard Python testing frameworks for functions defined in multiple Databricks notebooks that are currently in production?
How can a Data Engineer execute unit tests using standard Python testing frameworks for functions defined in multiple Databricks notebooks that are currently in production?
Explanation:
The correct approach is to use a separate Databricks notebook to define and import unit test functions. This allows the data engineer to run tests without modifying the production notebooks. By using %run
commands in the test notebook, the production notebooks' functions can be imported and tested using standard Python frameworks like unittest
or pytest
. Options B and D involve restructuring code into files or altering production notebooks, which may not be feasible. Option C relates to test data, not the testing framework setup, making it irrelevant to the specific question about executing unit tests.