...
Note that for building an application, you only need to include the CDAP API in your dependencies. For testing, however, you need the CDAP run-time. To build your test case, extend the TestBase
class.
Running Tests with
...
Spark3
The TestBase
class included in the cdap-unit-test
dependency will run programs using Spark2 and Scala 2.11. If you need to unit test a program that uses Spark3 and Scala 2.12, you must remove the cdap-unit-test
artifact from your Maven test dependencies and replace it with cdap-unit-test3_2.12
:
...
Often the easiest way to verify that a test produced the right data is to run a SQL query, if the data sets involved in the test case are record-scannable, as described in Data Exploration. This can be done using a JDBC connection obtained from the test base:
...