It could be that the Xindi needed to test the weapon in "local Earth space" rather than "Expanse space." The space anomalies created by the spheres might have made space different enough in the Expanse that the Xindi felt a need to test the tech where it was supposed do do its damage, to make sure it would work properly.
More than agree. Not just "could" be, but must be. This aspect could not be tested in home territory. The device was probing the path to Earth.
Also, the Xindi needed to test Eath defenses. The device was probing possible resistance. Obviously this couldn't be tested in the Expanse.
The only question is why the Xindi wouldn't expend titanic resources on a final solution weapon when they didn't know how to successfully negotiate a journey out of the Expanse, then attack against an unknown defense capabilty? I think the ansswer is obvious.
Despite the popularity of the idea that the test firing was a plotting error, it is entirely mistaken.