I've been reading about Hiroshima lately, since it recently was the anniversary of the attack, and this BBC timeline (https://www.bbc.co.uk/teach/countdown-to-hiroshima-the-bomb-that-changed-the-world/zkpwrj6) included this line: "The Pentagon receives a coded message: 'Successful in all aspects. Visible effects greater than Trinity test. Target Hiroshima.'"
I'm wondering how such tests were kept a secret from the world at large prior to the actual deployment of the atomic bomb
There was only one test, the Trinity test, and it was kept secret through a combination of isolation and misinformation. The test took place in a relatively underpopulated area of the country, on an army bombing range in south-central New Mexico. I've been there and it's a considerable distance from surrounding towns, and those surrounding towns are no great shakes either.
They tested the bomb early in the morning, and many people saw it as a bright flash on the horizon. The military had agents in each of the surrounding towns, monitoring what people said about it. They released a statement saying that an ammunition dump had exploded (which can be quite an explosion, as the recent Beirut explosion makes clear); the agents reported that people seemed satisfied with that explanation. The news of the ammunition dump was carried in many newspapers as a very minor item.
They only had to keep it secret for about two weeks — not forever. Keeping a large secret for a short amount of time is possible, even though it frequently takes great effort.