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