The invention discloses a method for testing the mechanical property of a metal-based composite material matrix. The method comprises the steps of sample preparation, testing, screening, calculation,fitting and result obtaining. A plurality of nanoindentations are punched on the surface of the to-be-detected composite material; and a load-displacement curve for the screened nanoindentations is output to solve equivalent modulus, parameter curvature, rigidity and maximum indentation depth, characteristic stress, characteristic strain, strain strengthening index and stress-strain relationship are calculated according to a dimensionless function to obtain a stress-strain value, and then the stress-strain value is simulated and optimized. And the characteristic stress, the characteristic strain and the strain strengthening index are substituted into an elastic-plastic stress-strain model formula to obtain the mechanical properties of the to-be-tested composite material. The elasticity modulus, the hardness, the stress-strain curve and the elastic-plastic constitutive equation can be obtained only through one-time detection, and compared with traditional stretching and Vickers hardnesstesting, the surface of the sample is not damaged, the efficiency is higher, and measurement is more comprehensive.