The invention relates to a wire coil with an automatic wire winding function for an electrical test. The wire coil comprises a lower end cover, an upper end cover, a coil spring winding device, a winding wheel, an upper wire winding disc, a coil spring, a wire cable connector device, an automatic emergency stop device, a wire cable dust removing device, a wire cable and the like. The winding wheel is arranged on the lower end cover. The coil spring winding device is arranged inside the winding wheel. The coil spring is arranged between the coil spring winding device and the winding wheel. The upper wire winding disc is arranged on the winding wheel. The wire cable connector device is arranged in the position, located above the upper wire winding disc, of the winding wheel. The wire cable penetrates through the winding wheel to be connected with the wire cable connector device. The wire cable dust removing device and the automatic emergency stop device are sequentially arranged at a wire cable inlet of the wire disc. When the wire coil winds the wire cable, the winding speed of the wire cable is decreased before the wire cable reaches the winding tail end, the phenomenon that the winding speed is excessively large, so that the tail end of the wire cable hurts a human body is avoided. Meanwhile the wire cable dust removing device sweeps the recycled wire cable to keep the wire cable clean. The wire coil totally adopts the mechanical structure, so that energy is saved, and the using range is enlarged.