Let's now learn about integration testing using SparkSession.
In this section, we will cover the following topics:
- Leveraging SparkSession for integration testing
- Using a unit tested component
Here, we are creating the Spark engine. The following line is crucial for the integration test:
val spark: SparkContext = SparkSession.builder().master("local[2]").getOrCreate().sparkContext
It is not a simple line just to create a lightweight object. SparkSession is a really heavy object and constructing it from scratch is an expensive operation from the perspective of resources and time. Tests such as creating SparkSession will take more time compared to the unit testing from the previous section.
For the same reason, we should use unit tests often to convert all edge cases and use integration testing only for the smaller part of...