Boston Mayor Marty Walsh is encouraging all city residents to get tested for coronavirus, even if they have no symptoms.

"Getting tested is how we keep families and yourself safe," Walsh said in a Tuesday interview with GBH News. "It's also how we track the presence of the virus in our communities and it helps us focus on our responses [and] where they're needed."

The city has set up free mobile testing sites for asymptomatic people in Central Square Park in East Boston and Nubian Square in Roxbury.

The percentage of tests that come back positive for COVID-19 has been steadily climbing in Boston. Five weeks ago, 2.8 percent of tests were positive. Last week it was 6.2 percent.

The city is especially encouraging testing for anyone who has symptoms, is at high risk for complications from COVID-19, has been in contact with an infected person or who has traveled or been in large gatherings. But Walsh says even if residents don't meet any of that criteria, they should still be tested.

"You could be asymptomatic and not realize it, and you could be a carrier of the virus," Walsh said. "It's very important that everyone get tested right now, as we see this increase in numbers."

Walsh said the goal is to prevent another surge of cases in Boston.

"We don't want to go back to March, April, May and June, where our ICUs were over capacity, where hospitals had to basically shut down elective procedures," he said.

Boston residents aren't taking enough advantage of available testing, the mayor said. The number of people getting tested in Boston dropped by 300 last week.

"We have the capacity at 25 sites around the city of Boston to test over 2,000 people per day," Walsh said. "We're averaging about 1,500 people per day."

In addition to the two free mobile sites for asymptomatic residents, there are more than 20 other testing locations around the city, with varying policies about whether asymptomatic people can get tested and whether insurance will cover the test.

As of Tuesday, there were nearly 20,000 total cases reported in Boston and 777 deaths.

If numbers continue to climb, Walsh said, the city may have to reverse course on some reopening steps.

"Everything is on the table," he said. "We're looking at indoor dining, we're looking at gyms, we're looking at even our parks and seeing do we have to pull back on any restrictions. At this point, I would say we don't [need to announce new restrictions] today. But if this number continues to climb, obviously we have to take some action pretty soon here."

Experts in infectious disease transmission say testing asymptomatic people could be an effective strategy in slowing the spread of the virus.

"One of the difficulties with COVID is that all of our information is a little bit delayed because it takes a little while for people to develop symptoms and usually for those to get severe enough for them to actually trigger a test," said Stephen Kissler, a postodoctoral fellow in the Department of Immunology and Infectious Disease at the Harvard School of Public Health. "By encouraging testing asymptomatic people, we can get closer and closer to the actual infections that are happening right now, so we can be a lot more agile with our response."

Kissler said if asymptomatic people find out they're positive for COVID-19 they can change their behavior. "The difficulty with that, though, is that requires us to have tests that turn around very quickly," he said. With standard tests, "it still might be a couple of days before I get my test results back. At which point I may have spread infection to other people."

Kissler said increasing the availability of rapid tests will have the greatest benefit.

One other challenge is test accuracy, said Dr. Nahid Bhadelia, the Medical Director of the Special Pathogens Unit at Boston Medical Center and an Associate Professor of Infectious Diseases at Boston University School of Medicine.

"Many tests are less accurate in those who are asymptomatic, [since] you may not have enough virus yet for test to pick up," she said. That false confidence, Bhadelia said, was the problem at the Rose Garden event announcing the nomination of Amy Coney Barrett to the Supreme Court, where President Donald Trump, the first lady, several senior staff members and two U.S. Senators were infected.

"We should not let our guard down if we personally get a negative test," Bhadelia added.