Rake is sophisticated test runner written in Ruby and is a standard way of running test. You can do it with help of systems such as Rake.
You can see example of Rake files when you generate new Puppet module with puppet module generate companyname-modulename command.
In root directory of your project you will find Rakefile where you will see default configuration. In default configuration you can see that validation task is already done and ready to use. Make sure that paths are set accurately.
To run validation task you need to make sure that gems mentioned in Gemfile are installed. You can do it with bundle install. To run validation task just run
bundle exec rake validate