Implementing Jasmine tests with a Data-Driven approach
In the Data-Driven approach, Jasmine specs get input or expected values from the external data files (JSON, CSV, or TXT files, and so on) that are required to run the tests. In other words, we isolate test data and Jasmine specs so that we can prepare the test data (input or expected values) separately as per the need of the specs or scenarios. You can see the Data-Driven approach in the following diagram:
In this recipe, we will learn how to implement Jasmine specs for the scenarios described in the previous recipe, using the Data-Driven approach. For more details, refer to the previous recipe, Implementing Jasmine specs with Web/HTML.
How to do it...
You need to perform the following steps to implement Jasmine tests with the Data-Driven approach:
First, you need to create a
US_TaxEstimation_DataDriven_spec.js
spec file under the/spec
folder and get the following code from theUS_Tax_Estimation_spec.js
spec file created in the previous...