Copy SQL Server replication configuration from production to test environment
From the Microsoft Docs on Replication:

If you restore a backup of a replicated database to another server or database, replication settings cannot be preserved. In this case, you must recreate all publications and subscriptions after backups are restored.
In the event of server failure or the need to set up a test environment, you can modify the script by changing server name references, and it can be used to help recreate your replication settings. In addition to scripting your current replication settings, you should script the enabling and disabling of replication. For information about scripting replication objects, see Scripting Replication.

You can script the replication objects, then modify the server names to suit the test/dev environment via SQL Server Management Studio:

Connect to the Distributor, Publisher, or Subscriber in Management Studio, and then expand the server node.

Right-click the Replication folder, and then click Generate Scripts.

Specify options in the Generate SQL Script dialog box.

Click Script to File.

Enter a file name in the Script File Location dialog box, and then click Save. A status message is displayed.

Click OK, and then click Close.


The resulting script can then be ran against the test/dev environment to automatically setup replication, just ensure you modify all server names as needed.  You really don't want the test/dev environment to interfere with the production environment.