Changes for page Test Speedup
Last modified by chrisby on 2025/03/08 11:39
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -20,12 +20,10 @@ 20 20 21 21 **Synchronous Testing** 22 22 23 -A simple test-drivenworkflow is to write new code,executetests locally, wait for them to finish and if they passthengoing on. To avoid long wYou only execute a few, very fast testssacrificing that all tests checkyour latest changes.23 +A simple TDD workflow is to write new code, run tests locally, wait for them to finish, and if they pass, move on. To avoid long wait times, you run only a few very fast tests. This is fine when you are working on isolated code that is checked by unit tests, but as soon as integration of the new code with the old code comes into play, it becomes a problem. Now you have two bad choices: either you run a few fast tests and do not use the full power of your test suite, resulting in low coverage and possibly missing bugs that would have been easier to fix if they had been caught earlier, or you run all the tests locally and are unproductive for a long time while waiting for them to finish. This problem can be solved with asynchronous testing. 24 24 25 -Although asynchronous testing has its place when 26 - 27 27 **Asynchronous Testing** 28 28 29 - isaworkflowthatworkswellwhen the testtakeafewecondsonly.Thishasthedisadvantage thatyou onlycheckyour code changes forcorrectness againstjust afewvery fast tests.27 +When you push code into the code repository, there should be a DevOps infrastructure that triggers a CI pipeline that runs all the tests. This allows your code to be extensively tested while you continue to work without waiting. If the CI pipeline succeeds, the test suite has proven that your code changes are okay. If the CI pipeline fails, you should receive a notification, such as an SMS, email, or chat message that triggers a ringtone, or a desktop notification, so you can immediately stop what you are working on and fix the problem first. Apply the fix and continue working without waiting for the tests to finish. 30 30 31 -I nsteadof waitingfor yourteststo finish locally, you shouldhavea DevOps infrastructurewhichtriggers a CI pipelinewhenpushingthecode executingalltests.Doing thatnablesyoutodirectlygoon working withoutthe needto waitminutesfortheests to finish.Incasethe CI pipelinefails,youshouldgetanotificationtofixthe CI pipeline immediately.Thisenables quite comprehensivetesting, even havingthesame testing jobs running in parallel, even long takinges.29 +It is not uncommon that one developer that way triggers many CI pipelines running simultaneously. While this technique may require advanced DevOps infrastructure to realize, it's often worth the investment for setup. Or you can simply pay cloud providers such as GitLab or GitHub that do this automatically in the background.