# An Experimental Evaluation of Path-Based Product Line Integration Testing and Test Coverage Metrics
## 4 Cost and Benefit Functions for Estimation  
This study introduces cost functions for the cost/benefit analysis of product line testing based on the proposed method and test coverage metrics. To begin, the following variables were defined:  
* \(N_{xx}\) represents the number of xx-MM-paths of a product line. For example, \(N_{cc}\) indicates the number of cc-MM-paths in the product line;
* \(N_{MM-path}(p_{i})\) refers to the total number of MM-paths for product \(i\); and
* \(N_{xx}(p_{i})\) indicates the number of xx-MM-paths for product \(i\). For example, \(N_{vc}(p_{i})\) represents the number of vc-MM-paths for product \(i\).  
Next, the following cost functions were used to evaluate the proposed method by utilizing the proposed test coverage metric:  
* \(C_{driving\_path}\) is a function that, given the relevant parameters, calculates the cost for a test organization to derive MM-paths for a product or a product line;
* \(C_{exec}\) is a function that, given the relevant parameters, calculates the average cost for a test organization to determine test inputs and execute tests for all defined MM-paths;
* \(C_{aux}\) is a function that, given the relevant parameters, calculates the cost for a test organization to develop auxiliary test code (aux), including \(C_{driver}\) and \(C_{stub}\), representing the average cost of developing drivers and stubs, respectively (this cost function performs estimation based on the number of required drivers and stubs); and
* \(C_{cxx}\) is a function that, given the relevant parameters, calculates the cost for a test organization to design and run tests based on a specific test coverage criterion. For example, \(C_{C_{cc}}\) represents the total cost of the product line testing when using the cc-MM-path test coverage.  
When each product of a product line using the MM-path-based integration testing method is tested in a stand-alone manner, the total cost of testing is estimated by the following Equation (1):Cost of testing \(n\) products in a stand-alone manner \(=\sum_{i=1}^{n}\left(N_{MM-path}(p_{i})\times C_{exec}+C_{driving\_path}\right)\) (1)  
Since MM-path-based integration testing uses actual codes for stubs or drivers, Equation (1) does not need to consider such costs.  
The cost of testing the entire product line can vary depending on the test coverage employed in platform testing. In this cost function, the costs required for testing the product-specific parts are not taken into consideration. Equation (2) is a generic equation that does not specify the test coverage used in platform testing.  
\[C_{Cxx}=C_{driving\_path}+N_{xx}\times C_{aux}+\{\ N_{xx}+\sum_{i=1}^{n}\left(N _{MM-path}(p_{i})-N_{xx}(p_{i})\right)\}\times C_{exec} \tag{2}\]  
For the \(C_{cc}\) coverage metric, i.e., xx is cc, there is no need for the cost of developing auxiliary test code, i.e., \(C_{aux}\)_is_ 0. Therefore, the resulting cost function is derived as following:  
\[C_{C_{cc}}=C_{driving\_path}+\{N_{cc}+\sum_{i=1}^{n}\left(N_{MM-path}(p_{i})-N_ {cc}\right)\}\times C_{exec}\]  
If the \(C_{cc}\) coverage is selected, both cc-MM-paths and vc-MM-paths containing variability are tested in platform testing. Since each member product of a product line does not need to retest cc-MM-paths and vc-MM-paths, the cost can be estimated with the following function derived from Equation (2):  
\[C_{Cxx}=C_{driving\_path}+N_{cc}\times C_{aux}+\{\ N_{cc}+N_{cc}+\sum_{i=1}^{n} \left(N_{MM-path}(p_{i})-N_{cc}-N_{cc}(p_{i})\right)\}\times C_{exec}\]  
The benefit, representing the cost savings achieved by testing through the method and metrics compared to the cost of testing in a stand-alone manner, can be calculated using the following Equation (3):  
\[\text{Benefit }B=\frac{\text{{Equation }}(1)-C_{cxx}}{\text{{Equation }}(1)} \tag{3}\]