An in-situ testing device used in an ultra-high vacuum test system, characterized by comprising: a testing chamber installed in the ultra-high vacuum test system and arranged on a sample transport line of the ultra-high vacuum system, the testing chamber being provided with a first optical observation hole and with a shielding door rotatably or slidably connected to the testing chamber; a measuring head being connectable to the testing chamber and insertable into the testing chamber by a transport device of the sample transport line, the measuring head being provided with a second optical observation hole such that the position of the second observation hole is aligned with a position of the first optical observation hole when the measuring head is placed into the testing chamber, the testing chamber being provided with an opening allowing the measuring head to pass; a drive mechanism connected to the shielding door, and configured to drive the shielding door to move relative to the testing chamber, to open or cover the opening, thereby opening or closing the testing chamber; a sample and a probe being placed in the measuring head, the sample being aligned with the probe by means of optical observation, wherein the in-situ testing device is configured to perform a preliminary test to ensure that electrical properties of the sample are proper after the alignment; and a first electrode adapter plate arranged at a lower end of the measuring head; and wherein: the testing chamber is provided with an electrode base oppositely joined to the first electrode adapter plate; a plurality of grooves are asymmetrically disposed on the electrode base; a plurality of protrusions respectively fitting the plurality of grooves are disposed at the lower end of the measuring head; the plurality of grooves fit the plurality of protrusions; and the first electrode adapter plate is aligned with the electrode base. a testing chamber installed in the ultra-high vacuum test system and arranged on a sample transport line of the ultra-high vacuum system, the testing chamber being provided with a first optical observation hole and with a shielding door rotatably or slidably connected to the testing chamber; a measuring head being connectable to the testing chamber and insertable into the testing chamber by a transport device of the sample transport line, the measuring head being provided with a second optical observation hole such that the position of the second observation hole is aligned with a position of the first optical observation hole when the measuring head is placed into the testing chamber, the testing chamber being provided with an opening allowing the measuring head to pass; a drive mechanism connected to the shielding door, and configured to drive the shielding door to move relative to the testing chamber, to open or cover the opening, thereby opening or closing the testing chamber; a sample and a probe being placed in the measuring head, the sample being aligned with the probe by means of optical observation, wherein the in-situ testing device is configured to perform a preliminary test to ensure that electrical properties of the sample are proper after the alignment; and a first electrode adapter plate arranged at a lower end of the measuring head; and wherein: the testing chamber is provided with an electrode base oppositely joined to the first electrode adapter plate; a plurality of grooves are asymmetrically disposed on the electrode base; a plurality of protrusions respectively fitting the plurality of grooves are disposed at the lower end of the measuring head; the plurality of grooves fit the plurality of protrusions; and the first electrode adapter plate is aligned with the electrode base. the testing chamber is provided with an electrode base oppositely joined to the first electrode adapter plate; a plurality of grooves are asymmetrically disposed on the electrode base; a plurality of protrusions respectively fitting the plurality of grooves are disposed at the lower end of the measuring head; the plurality of grooves fit the plurality of protrusions; and the first electrode adapter plate is aligned with the electrode base.