All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Undergoing this semen analysis test requires you to masturbate during the daytime in Ramadan. According to most of the Muslim scholars, however, masturbation invalidates the fast. Therefore, you should postpone this test until after Ramadan or you could take it at night once the curfew is lifted. May Allaah remove your hardship and destroy your enemy!
Allaah Knows best.