I'm not referring to the obvious development testing, but the life cycle of individual engines. When a rocket is launched, have those specific engine "serial numbers" been previously test-run? Like the way the engine in your brand new car has already been run before it leaves the factory. Is it a necessary Q/A step for all rocket engines, or is launch the first (and presumably only) time some engines have ever run? If they are test fired, how does it compare to actual flight run in terms of duration and thrust level? If some engines are tested pre-flight and others not, what determines which engines do or do not get a pre-flight test firing?
No. At least one engine wasn't: the NK-15 as used on the N-1 first stage. These engines were rated only for a single start. They would build a batch of engines, test some of them, and any failure was a reason to scrap the whole batch. Clearly, this was not optimal, so its replacement, the NK-33 (which was to be used from the fifth launch onwards) was designed so it could be run more than once.
For the European engines, I can say that they test run every engine for new designs until they are very confident in the manufacturing quality. Then they only test run if they make changes (even pretty minor ones) and also periodically to check that the engines are still identical to the ones that were qualified earlier. It's possible that tiny unintentional changes in manufacturing accumulate to change how the engine runs. Such changes may not be detectable in the sparse data they get from the flight engines, hence the periodic tests.
Can't post a complete answer because I only know about Shuttle, but all the SSMEs were "green run" before being flown and after major repairs.
For the majority of the Space Shuttle Program, SSMEs were assembled at Pratt & Whitney Rocketdyne’s Canoga Park, California facility. Engines were then shipped to Stennis Space Center (SSC) for testing. Development engines remained at SSC. Flight engines were tested and, pending successful post-test inspections and a completed engine acceptance review, delivered to Kennedy Space Center where they were readied for flight.