Refactor add test cmake code

2 jobs for master in 15 minutes and 52 seconds (queued for 2 minutes and 56 seconds)
Status Job ID Name Coverage
  Build
passed #20106
linux kf5-qt5 qt5.12

00:07:04

34.0%
passed #20107
windows
windows kf5-qt5 qt5.13

00:08:47