Diagnostic testing is used for several different purposes in medicine, including counselling patients, public heath surveys, blood screening, pharmacology, etc. Diagnostic algorithms (programmed test sequences) are usually developed by panels of experts without any formal quantitative analysis. This process is slow and often yields suboptimal results that are not adapted for very different diagnostic purposes and do not account for reliabilities of the various underlying tests. Customizing a diagnostic algorithm requires searching over testing topologies to find an algorithm that comes as close as possible to meeting given constraints (e.g., limiting average cost per patient) that optimizes given criteria (e.g., maximizing prediction reliability). In order to guarantee the constraints have been met, the inherent uncertainties in diagnostic testing parameters (i.e., sensitivity and specificity based on limited empirical sampling) can be propagated through calculations using robust Bayes methods. This approach can also handle potential correlations and dependencies among tests and across test performance statistics. The resulting test topology can maximize the selected criterion while meeting the constraints, with generally different answers for different medical purposes. Using such an approach to design medical test algorithms will improve public health by allowing a more efficient allocation of public health resources from quantitatively optimized testing strategies and by allowing doctors and patients to make better health decisions because of full knowledge of the concomitant uncertainties in the diagnostic process. For-purpose designs of diagnostic algorithms are better than other algorithms because they can be fashioned to meet a priori specifications about surety, cost, time, invasiveness, etc., or to optimize performance on such a factor. Traditional designs are inflexible and often ad hoc, so they are rarely optimal and may not satisfy performance goals. The proposed approach, implemented in appropriate software, can also produce algorithms designed in real-time, making them more responsive than traditional algorithms designed by committee. The statistical performance of the algorithms can be assessed formally using reliable robust Bayesian methods that simultaneously have guaranteed coverage probabilities under a frequentist interpretation of probability. Numerical examples will be given to illustrate the advantages of the proposed approach.