The verification of a modular system composed of communicating components is a difficult problem, especially when the formal specifications, i.e. models of the components are not available. Conventional testing techniques are not efficient in detecting erroneous interactions of components because interleavings of internal events are difficult to reproduce in a modular asynchronous system. The problem of detecting intermittent errors and other compositional flaws in the absence of components' models is addressed in this paper. A method for inferring a controllable approximation of communicating components through testing is elaborated. The inferred finite state models of components are used to detect compositional problems in the system through reachability analysis. To confirm a flaw in a particular component, a witness trace is used to construct a test applied to the component in isolation. The models are refined at each analysis step thus making the approach iterative. The proposed approach employs techniques for machine inference, testing and reachability analysis, and can reveal flaws due to the nondeterministic behaviour of a modular distributed system, such as unspecified receptions, livelocks, divergences, and races that would not be detected by testing alone. One key advantage of the approach is that by means of the inference parameter, it allows one to find a compromise between the co mplexity of testing the integrated system and the precision of the resulting models. The use of large tests is completely avoided in testing a component in isolation, since only single diagnostic test is executed in each iteration. Another advantage of the approach is that inferred models capture the functionalities of components used in the given system; unused behaviours of components are not modelled.