In software development and testing, detecting and mitigating faults are paramount to prevent potential issues from escalating and disrupting the development and testing processes. The proposed method can also improve the prediction of various is sues, such as increased model complexity, longer execution times, higher error rates, and enhanced fault detection capabilities. Addressing this concern, the paper introduced a three-stage model encompassing data pre-processing, feature dimensionality reduction, and fault prediction, which are essential steps in effective software testing. Our research leverages the publicly available NASA dataset and employs Principal Component Analysis (PCA) and Linear Discriminant Analysis (LDA) to re duce feature vector dimensions, a common practice in software testing. We propose an improved version of the Grey Wolf Optimization (IMGWO) algorithm, complemented by Extreme Learning Machines (ELM), to discern the presence of defects within software modules. This approach is highly relevant in software testing, as it aids in identifying problematic areas early in the development cycle. Utilizing the PCA-LDA+IMGWO-ELM approach, our model achieves an average accuracy rate of 0.9811 when applied to the KC2 dataset, a significant milestone in software testing. These results are substantiated through experimental validation, reinforcing the credibility of our approach in predicting potential software defects during the software testing phase.