Would be better to avoid flight if possible. If you cough or show visible symptoms when airborne, some passengers may feel uncomfortable and may even curse you silently.
Testing can help, but human mind...some people may think negatively of you. Of course, if it is needed, then nothing can be done.