This paper presents a comprehensive study on the evolution of the small-strain shear modulus (G) of granular materials during hydrostatic compression, conventional triaxial, reduced triaxial, and p-constant triaxial tests using 3D discrete element method. Results from the hydrostatic compression tests indicate that G can be precisely estimated using Hardin's equation and that a linear correlation exists between a stress-normalized G and a function of mechanical coordination number and void ratio. During the triaxial tests, the specimen fabric, which refers to the contact network within the particle assembly, remains almost unchanged within a threshold range of stress ratio (SR). The disparity between measured G and predicted G, as per empirical equations, is less than 10% within this range. However, once this threshold range is exceeded, G experiences a significant SR effect, primarily due to considerable adjustments in the specimen's fabric. The study concludes that fabric information becomes crucial for accurate G prediction when SR threshold is exceeded. A stiffness-stress-fabric relationship spanning a wide range of SR is put forward by incorporating the influences of redistribution of contact forces, effective connectivity of fabric, and fabric anisotropy into the empirical equation.