In this paper, we have introduced a software reliability growth model (SRGM) that integrates a Weibull testing effort function (TEF) within the software fault detection process (FDP) and fault correction process (FCP), effectively capturing the intricacies of software testing. Leveraging the least squared estimation method, we estimated both model parameters and the TEF, leading to a notably improved fit with the dataset and enhancing our comprehension of software reliability dynamics. Our approach also involved employing a reliability-based method to identify the optimal time for software release, further reinforcing the robustness of our model. Subsequently, we devised an optimal control model to minimize testing efforts throughout the software development life cycle. This work provides a comprehensive methodological framework for computing the total cost while ensuring debugging costs follow a learning curve pattern. Through numerical simulations involving hypothetical values and the Weibull TEF, we observed that once the software achieves the desired reliability for release, subsequent costs gradually decline to zero. In essence, both testing and future costs converge to zero post-release, reducing instantaneous expenses.