Wiring a four wire gfci with a ground wire
First you need to make sure the breaker for the circuit you are working on is turned off. If you are using a voltage tester and are properly trained test the circuit at the outlet to verify 120 vac. Next turn the breaker off and retest. Make sure the breaker stays off while you are working on the outlet. Other people in the house can make an honest mistake so you need to take precautions. You now should read no voltage or something low 12-16 volts depending on the quality of your tester. Next check your tester on a outlet that still has power and read 120 vac. This process will verify your tester is working properly and you will not get hurt or worse! It sounds like you have two black and two white wires along with the ground wires. Separate the wires so they stick out of the box straight and are paired up. Make sure no one goes near the exposed wires. Turn the breaker you turned off back on and check each pair testing the black to white so you can identify the feed. After you have tested both sets of wires and found the feed turn power back off and repeat the testing process. Make sure someone does not turn the breaker on when you are working on the exposed wires. To install the GFCI the black and white wires you had voltage on connect to the side marked line. Good tight connections are very important. Next connect the black and white that had no power to the load side of the GFCI outlet provided GFCI protection is required down stream. Turn power back on, test for power, push the trip button, verify no power, push the reset and test for good power, finally test the trip on the outlet every 30 days to insure safe operation.

Regards
John J Deery
Master Electrician