Hello from JustAnswer.
It depends upon which type of drug test is being done.
A screening urine drug test (typically an immunoassay) can only detect drug classes, so if Vicodin and Percocet are detected, it will only cause a positive test for opiates. It is also worth noting that screening urine drug tests are not great at detecting either Vicodin or Percocet. The screening urine drug test is designed to detect morphine and those drugs that are converted into morphine, such as heroin and codeine. The Vicodin and Percocet are semi-synthetic and are not converted into morphine, so are frequently missed by a screening urine drug test. Regardless of whether it successfully detects them or not, the screening urine drug test cannot differentiate between the two drugs.
However, a confirmatory urine drug test, such as GC/MS (gas chromatography/mass spectrometry), would be able to differentiate between the two drugs. The confirmatory urine drug test can identify each individual opiate and the common metabolites of each drug, so can tell whether someone has taken either drug or both.
The common approach in most drug testing programs, such as an employment program, will perform a screening urine drug test first, and if any result is positive, a confirmatory urine drug test will be done. In that setting, if the screening test fails to detect either drug, then a confirmatory test will never be done. However, there are also situations in which a confirmatory urine drug test is routinely done, such as doctors monitoring chronic opiate prescriptions wanting to know whether another opiate has been taken. In that setting, the confirmatory urine drug test will typically differentiate between these two drugs, assuming that the drugs have not yet been cleared from your system.
If I can provide any additional information, please let me know.