The invention discloses a star sensor function test method based on electric injection star map, which comprises simulating the track parameter and attitude of satellite motion and simulating a star map shot by a star sensor, using the star point center to refresh and transmit part of the star map, laminating the part refreshes in the star map background of the star sensor, positioning star point, recognizing star map and calculating altitude, checking the results of the star map recognition and altitude calculation of the star sensor. The invention discloses a relative device. The invention has high refresh rate of star map, which can simulate the track altitude of star sensor and can process ground simulation test with whole star system, without additional external devices and special application condition demand, but with strong versatility.