When we write software it is good practice to also write tests. Either before writing actual code or after, we still need to write tests. In Grails we can use the test-app
command to execute our tests. If we specify the extra option -continuous
Grails will monitor the file system for changes in class files and automatically compiles the code and executes the tests again. This way we only have to start this command once and start writing our code with tests. If we save our files, our code gets compiled and tested automatically. We can see the output in the generated HTML report or on the console.
Suppose we have our Grails interactive shell open and we type the following command:
grails> test-app -continuous | Started continuous test runner. Monitoring files for changes... grails>
Written with Grails 3.1.6.