A 23-year-old male had unprotected sexual intercourse with a commercial sex worker. Two weeks later, he developed a painless, indurated ulcer on the glans which exuded clear serum on pressure. Inguinal lymph nodes in both groins were enlarged and not tender. The most appropriate diagnostic test is –
It is very easy to diagnose an STD by a simple stepwise approach

​Step -1

The first step is to see whether the ulcer is painful or painless.
Painless ulcer     →   LGV, donovanosis, chancre.
Painful ulcers    → HSV, chancroid.

Step - 2

For painless ulcer, see whether lymphadenopathy is present or not:-
Lymphadenopathy (+)nt → LGV, chance
No lymphadenopathy   →  Donovanosis
If lymphadenopathy is (+)nt, see whether it is painful or not:-
Painful lymphadenopathy → LGV
Painless lymphadenopathy → Chancre
	​

Now see the question
Step -1
An ulcer is a painless → Chancre, LGV or Donovanosis.

Step - 2
Inguinal lymphadenopathy (+)nt → Chancre or LGV (Donovanosis is ruled out).
Lymphadenopathy is non-tender → Diagnosis is chancre (LGV is ruled out).

As the clinical diagnosis is chancre (Primary syphilis), Lab. diagnosis can be made by darkfield microscopy of ulcer discharge
Gram's stain of ulcer discharge
Darkfield microscopy of ulcer discharge
Giemsa stain of lymph node aspirate
ELISA for HIV infection