A major issue in the production of software by a software company is the estimation of the total expenditure likely to be incurred in developing, testing, and debugging a new package or product. If the development cost and development schedule are assumed known, then the major cost factors are the testing cost, the risk cost for the errors that remain in the software at the end of testing, and the opportunity cost. The control parameters are the times at which testing begins and ends, and the time at which the package is released in the market (or the product is supplied to the customer). By adjusting the values of these parameters, the total expenditure can be minimized. Internet technology makes it possible to provide software patches, and this encourages early release. Here we examine the major cost factors and derive a canonical expression for the minimum total expenditure. We show analytically that when the minimum is achieved (1) testing will continue beyond the time of release and (2) the number of software errors in the package when testing ends will be a constant (i.e., the package will have a guaranteed reliability). We apply the model to a few special scenarios of interest and derive their properties. It is shown that the incorporation, as a separate item, of the cost incurred to fix the errors discovered during testing has only a marginal effect on the canonical expression derived earlier.