[UT coverage] How can the industry improve QT code coverage
Hello everyone, I am a C++ QT application engineer in the industry.
After nearly 10 years of iteration, our products are facing the problem of lower and lower code Unit test coverage. Low code coverage is very detrimental to code quality and product quality.:o
So we have been looking for ways to improve QT code unit test coverage or some guiding principles.
I would like to ask industry experts if they can provide some experience to guide us to improve QT unit test coverage?:)
Thank you so much.
Re: [UT coverage] How can the industry improve QT code coverage
A useful approach is to set coverage metrics as test criteria before merging code, and use mocking to isolate tests. QT testing can be complex, but with the right approach, efficiency comes.
**Moderator note: Spam URL removed. There is zero tolerance for spamming on this forum. Next time, your posts will be deleted and you will be banned.**
Re: [UT coverage] How can the industry improve QT code coverage
Hi
Thanks for reply on my question. Now we have a complete QTest framework in out QT application, including many metrics on it. But R&D found it was hard to write the UT since they sometimes felt that it was not smooth enough to cover all of the classes.
Now in our QT application, we found that refactor the code by the MVC (Model-Viewer-Controller) design to decouple the classes might be also a possible way to help the R&D to write the unit test coding since some classes did not well follow the MVC design.
If you have more detailed idea on it, pls share more information with us.
Re: [UT coverage] How can the industry improve QT code coverage
Refactoring your code into an MVC design might be a good way to allow implementing unit tests more easily, since the data model is not tightly coupled to the UI in this case. You can test the model using a command line program since the model does not require a user interface.
Depending on how deeply you want to refactor, you could even package your model into a separate library that could allow testing outside of your application.