Recommendation for integration tests on 12 different test environments

I am building out our enterprise solution and have a problem to solve.

Our infrastructure design is very old. Some systems date back 40 years. One of the ancient systems that will not change is we have 12 full stack test environments, each for different purposes, configurations, and audiences.

Now, we are moving all of our Selenium, SoapUI, RestEasy, and RFT (Rational Functional Tester) scripts into Gradle projects to allow them to be run on the server instead of our current method of running them on some poor saps laptop.

So, in Urban Code, the tester will have their application configured. Their application will be the repository that contains all of their tests. Within UC, the tester will be able to select the environment (say tenv3), then say run Gradle tasks X, Y, Z. From there, what UC will do is push all the needed info to one of our test runner agents, then on that agent, drop to a command line and do

gradlew X Y Z -Penv=tenv3

everything up to this point is a piece of cake. Now, the hard part.

How do I use this to pass URL’s to the test code itself?

What i mean is if i have a selenium suite that is testing the application at the url mycompany.com/app_abc, then the full URL for tenv3 MIGHT be tenv3.mycompany.com/app_abc. Telling Gradle this is no big deal, but how do i tell the Java, or JavaScript, or Python, or C#, or any of the other 22 languages code that the suite is intended to be executed against environment X

For the gradle piece of this puzzle, i kinda like this solution

I think it is simple enough to be rugged. But for the other piece of getting those url’s or settings to the test code itself, the only thing i can think of write a task that takes these properties out of the gradle build and use them to create something like a URL.property file and put that file in the build/resources folder, hoping the test code will pick that up into the classpath. Then the test code can access it with some relatively simple Class.getResource() calls. And since it will always be in a known location, i can just look for it there in the other languages as well

Now, I know environment variables may seem like a logical way of doing this, but please, no. I’ve already had to strip environment variables out of other systems because of problems with forked JVM’s, multiple copies running at the same time, and so on and so forth, its just not reliable enough for me.

What are some other ways that you guys have solved this problem on a large scale?