You need to configure the code coverage measurement before using the coverage function.
The setting method differs depending on the debug tool used.
2.13.1.1 [IECUBE]
2.13.1.2 [Simulator]