Selecting and testing patterns