Self-diagnostic
A self-diagnostic was a diagnostic that a machine, system, cybernetic organism, or android performed on itself to check for errors, usually on a regular basis.

Soong-type androids like Data would initiate self-diagnostics at regular intervals to verify that all functions were within established parameters. 

Data ran a self-diagnostic in 2369 after it seemed that he had lost over 90 minutes of memories as his internal chronometer was not in sync with the ship's chronometer leading him to believe that he was experiencing a malfunction. It later turned out that he had been abducted by solanogen-based lifeforms and that his systems were functioning properly. ()

That same year, after the  computer began experiencing a series of malfunctions due to an interface experiment conducted by Data and Geordi La Forge, he stated that he would perform a self-diagnostic. ()

In 2372, after B'Elanna Torres had repaired Automated Personnel Unit 3947 for the most part, he reported that his self-diagnostic showed that he was operating at 68% of peak operating capabilities. ()

Later that year, The Doctor ran a level-two self diagnostic on his program when he claimed to have suffered lapses in concentration. Kes believed that it was not a technical problem, but that he had feelings for Danara Pel. ()

In 2373, after the effects of long-term use had begun affecting The Doctor, he claimed that his self-diagnostic routines have always indicated that in the event of cascade failure he should be completely re-initialized. But the crew of  were worried that if he did that, all his memories and individualism would be erased. ()

In 2375, the cybernetic Human Seven of Nine ran a complete self-diagnostic due to experiencing dizziness and double vision. At first, she believed her ocular implants had malfunctioned, but after she consulted the Starfleet Medical Database she determined it was a flaw in her Human physiology. After considering all potential environmental and genetic factors, she concluded that she was suffering from Albright-Salzman syndrome. However, The Doctor believed it was safe to say that she instead was suffering from a mild case of sensory aphasia, which was neither rare nor life-threatening. Seven acknowledged her need of a second opinion and The Doctor responded about the danger of self-diagnosis; patients always assumed the worst. ()

Metaphorical use
In 2371, shortly after being stranded in the Delta Quadrant, Tom Paris wanted to double date with the Delaney sisters and Harry Kim. When Kim said he didn't have time, and that had to run a communications diagnostic, Paris told him he needed to run a self-diagnostic, because he shouldn't pass up an opportunity like going out with the Delaney sisters. ()

See also
Fluidic sensor diagnostic
Artificial lifeform components
Computer technology
Scans