There is a chance the memory slot for one of the memory modules is bad instead of the memory module itself. The memory slot nearest the Bottom Case tends to have a high rate of failure due to the solder joints on that slot cracking over time for those non-Retina models. Usually if this is the case, then pressing on the center of the bottom case will cause the laptop to freeze, or show graphical glitches/anomalies on the screen.
It is unusual for more than one memory module or memory slot to be defective at the same time. If the memory slot is not defective, then you can just use one of the original Apple 4GB modules which would still give you 12GB of RAM total and would also help to confirm whether the slot is bad. When testing....it is best to try only have one memory module installed at a time since it makes it easier to figure out which memory module is bad or even which slot although it can be tricky to confirm. Just make sure not to mix up the memory modules during testing.
Unfortunately some memory failures can be intermittent, so a passing diagnostic does not necessarily indicate you found the correct module/slot unless of course the test fails each time when using that particular module/slot.
You may find using a bootable Memtest86 USB stick may be useful in troubleshooting depending how well the Apple Diagnostics are in the endeavor. You can use the downloaded Memtest86 .img file as a source for Etcher which will create the bootable Memtest86 USB stick. Option Boot the Memtest86 USB stick and select the orange icon labeled "EFI". Once the memory test menu appears, you can even disconnect the USB stick.
If the default Memtest86 configuration does not detect a failure, then try modifying the Memtest86 CPU settings to "Round Robin" or "Sequential". I have discovered that sometimes these CPU options tend to detect issues more quickly & reliably than the default settings. Many times though I don't actually receive an error, but the test & laptop will freeze up which is just as good of an indicator as an actual error message.
I will usually uncheck the "Hammer" memory test (last one in the list) because it can report a failure even if the memory is good. It is great if this specific test passes, but a lot of good memory can fail the Hammer test.
If the Apple Diagnostics report a memory failure, then I would expect Memtest86 would as well since it usually has a few extra tests and also can be run for a longer time, but it would be best to confirm before making any hardware changes especially if no issue is reported by Memtest86.