In the current operational environment of the switch cabinet, the presence of mixed-frequency signals poses interference from white noise to partial discharge detection, resulting in suboptimal detection efficiency and accuracy. Therefore, this study explores a method for testing the partial discharge characteristics of switch cabinets based on an improved particle swarm algorithm. This novel approach involves signal processing of partial discharge in a switch cabinet, feature extraction based on the particle swarm algorithm, and feature output for partial discharge detection. Experimental comparisons demonstrate that the new detection method significantly enhances detection efficiency and ensures the accuracy of results, meeting the operational requirements of substations.