My nondiabetic crystal cat has frequent stones and infections so I have to test his urine several times a week if possible. I am lucky with him because he uses the same litter box most of the time and the other four do not use it much at all. I put small plastic bathroom cups along the edge where he usually goes. I am careful not to touch the inside of the cup. Many times he does a direct shot at the cup and he does not cover it up. So he is easy to test at home. If I need a sample for the vet, I set up the video camera to make sure it is his.
Now for my diabetic cat....he loves to build sand castles so if he did ring a cup in another litter box, it usually gets buried. He does not like me to slip a cup under him while he is going. He walks out and goes to another box. (I have five boxes for four cats). I used to be able to get a sample that dripped through the crack between the litter box and the lid. I put a piece of aluminum foil folded like a pan to collect it. It is not a good sample for testing anything except looking at pH and ketones since it is probably full of bacteria dripping through the crack. But it was good for ketones checks. Now I made a litter box out of a large storage bin to keep the spray in the box and not going on my floor. Don't know how to check for ketones now. Will have to think on that for a while. I did see the Smart Cat Box online that looks very interesting.