How to connect a mains 24Vdc and an Emergency 24Vdc supply to lights that should switch the mains supply off when the emergency feed is switched on
Maybe feed a 24vdc DPDT relay coil with the normal supply and put your test switch in series with the coil.
Also connect your normal 24vdc to the normally open contact on the relay, and your emergency 24v feed to the normally closed. Connect the wire to the lights on the common terminal of those 2 connections.
When you push the test button or have a power failure the relay drops out and the light is connected to the emergency 24v feed, release it and the relay energizes and it is fed from the normal 24v feed.