In the electronic computer-aided design area, the test generation problem consists in finding an input vector test for some possible diagnosis (a set of faults) of a digital circuit. Such tests may have some unspecified Primary Inputs (i.e. bits are assigned neither 0 nor 1). In fact, for many purposes, minimally specified tests (or patterns) are preferred. Hence, we have the test pattern optimisation (TPO) problem where the goal is to obtain a test with the maximum number of unspecified bits. In this paper we discuss different modelling approaches and present a TPO tool (Maxx) that substantially outperforms others by combining Branch-and-Bound and local search over distinct models. We apply the usual branch-and-bound search on CLP(FD) over a simple, yet incomplete, logic. A complementary Local Search is performed over an extended model, trying to improve an already computed solution by exploring an extended solution space thanks to the use of an extended logic (too complex for constraint solving). Such extended logic considers sets of dependencies on specified input values, keeping track of sources of unspecified values and their inversion parities. This allows modelling a number of alternative test vectors by unspecification of each possible input bit, thus being able to obtain an improved test vector in linear time. This paper shows, for TPO, that adapting constraint propagation with results obtained from local search outperforms the use of each of these techniques alone, obtaining significantly better results than those obtained with a highly efficient tool based on an integer linear programming formulation on a propositional satisfiability model.