Public leaders rarely test for HIV in public in Uganda, despite recommendations from health workers that it would set a good example in a country that has seen HIV infection rates increasing. Uganda was once a global leader in efforts to fight AIDS.
Not all government officials at the todays event in the capital, Kampala, joined the president in testing.
Ugandan officials have said they want to test 15 million people by the end of 2014. They acknowledge it will be hard to reach that target, the reason they want the president to be a "role model."
The HIV rate in Uganda stands at 7.3 per cent, up from 6.4 per cent in 2005, according to a 2011 survey by Uganda's Ministry of Health. Ugandan officials who presided over its reduction from 18 per cent in 1992 to 6.4 per cent in 2005 say they are confounded by the increase.
Ugandans health officials say more married couples are getting infected, in part because of what campaigners have dubbed a "sexual network" in which married Ugandans maintain secret lovers. One billboard in Kampala urges couples to "put your love to the test" by testing for HIV.