I am unable to find a way how to run code coverage in STS4.
In Eclipse Oxygen, I needed to do:
Right-click on project > Properties > Coverage to enable code coverage
Then, right-click on project > Run Code Coverage
However, both of these 2 options are missing in STS4
There is no code coverage feature installed by default in the Spring Tools 4 for Eclipse distribution (and never was, as far as I remember), but you might have had an Eclipse installation with such a third-party plugin installed. Maybe installing this from the marketplace helps:
marketplace.eclipse.org/content/eclemma-java-code-coverage