Your task is to reduce the test execution time. You can do this in various ways.
First you have to make some decisions about which test cases are mandatory, which test cases should be performed monthly, etc.
After defining the required test cases, you can create a set using the grouping of your test cases. If you run groups in parallel, this will reduce a huge amount of time. But your preparation for grouping should be difficult, so each group can use this type of time. This will be the best way.
For JUnit,
you can use a parallel process and a thread pool for how many threads your test cases will run (e.g. 20 threads for 5000 tcs)
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.7.1</version> <configuration> <parallel>classes</parallel> <threadCount>20</threadCount> </configuration> </plugin> </plugins> </build>
If we calculate here ... Suppose for each test case it takes 3 seconds to complete.
For 5000 * 3 = 15000 sec / 3600 = 4.166 hours.
Now, using parallel processing, it will take (5000/20) * 3 = 750 s / 3600 = 0.21 hours or only 12.5 minutes.
Resource reference: Running parallel junit tests in a Maven assembly?
For TestNG, Appium, Jenkins, etc.
To test the user interface, you can run multiple browsers so that they can run more test cases.
You can use multiple nodes to execute node several times and reduce time.
In some cases, you may be more complex, as you will not be logged in each case. There will be a starting point. Each test case will end and return this starting point. Using this method, we can also reduce the time. But this is a violation of FIRST
Various types of tools are used to analyze, report and display the code coverage status, runtime. JaCoCo is most popular among them. There are also tools such as Cobertura, Arkillian, etc.
A complete example of using JUnit, JaCoCo, and Maven to cover code is given here : https://softwarecave.org/2014/02/01/using-junit-jacoco-and-maven-for-code-coverage/
The full code is here: https://github.com/robertp1984/softwarecave/tree/master/jacoco