We present a group testing model for items characterized by marker random variables. An item is defined to be good (defective) if its marker is below (above) a given threshold. The items can be tested in groups; the goal is to obtain a prespecified number of good items by testing them in optimally sized groups. Besides this group size, the controller has to select a threshold value for the group marker sums, and the target number of groups which by the tests are classified to consist only of good items. These decision variables have to be chosen so as to minimize a cost function, which is a linear combination of the expected number of group tests and an expected penalty for missing the desired number of good items, subject to constraints on the probabilities of misclassifications. We treat two models of this kind: the first one is based on an infinite population size, whereas the second one deals with the case of a finite number of available items. All performance measures are derived in closed form; approximations are also given. Furthermore, we prove monotonicity properties of the components of the objective function and of the constraints. In several examples, we study (i) the dependence of the cost function on the decision variables and (ii) the dependence of the optimal values of the decision variables (group size, group marker threshold, and stopping rule for groups classified as clean) and of the target functionals (optimal expected number of tests, optimal expected penalty, and minimal expected cost) on the system parameters.