HIV infection and viral hepatitis due to HBV and HCV infection are major causes of chronic disease worldwide, and share some common routes of transmission, epidemiology, initial barriers faced in treatment access, and in strategies for a global public health response. Testing and diagnosis of HIV, HBV, and HCV infection is the gateway for access to both care and treatment and prevention services, and crucial for an effective HIV and hepatitis epidemic response. In this review article, we first summarize the common goals and guiding principles in a public health approach to HIV and hepatitis testing. We summarize the impressive global progress in HIV testing scale-up and evolution of approaches, with expansion of provider-initiated testing and counseling in clinical settings (particularly antenatal and tuberculosis clinics), the introduction of more community based testing services, and use of rapid diagnostic tests enabling provision of same-day test results. However, 46% of all people living with HIV are still unaware of their serostatus, and many continue to be diagnosed and start antiretroviral therapy late. As testing and treatment scale-up accelerates for an "treat all" approach, other challenges to address include how to better focus testing and reach those yet undiagnosed and most at risk, especially key populations, men, adolescents, and children. We summarize future directions in HIV testing to speed scale-up and close gaps that are addressed in the WHO 2015 consolidated HIV testing guidelines. In contrast to HIV, action in hepatitis testing and treatment has been fragmented and limited to a few countries, and there remains a large burden of undiagnosed cases globally. We summarize key challenges in the hepatitis testing response, including lack of simple, reliable, and low-cost diagnostic tests, laboratory capacity, and testing facilities; inadequate data to guide country specific hepatitis testing approaches and who to screen; stigmatization and social marginalization of those with or at risk of viral hepatitis; and lack of international or national guidelines on hepatitis testing for resource-limited settings. We highlight some of the key lessons applicable to hepatitis from the experience of expansion and diversification of HIV testing approaches over the last 30 years of the HIV response; in addition to forthcoming WHO tools to support the hepatitis global response. This includes a new 2016-2020 global hepatitis health sector strategy with testing and diagnosis targets, and 2016 WHO guidelines on hepatitis testing.