Currently we use the mendix deploy api to deploy our applications. After the deploy we use the webservice exposed in the mendix unit testing module to kick off the unit tests. If certain unit tests fail the webservice returns the failed unit tests in json format, which we output to the console. We use Jenkins to run this pipeline (deploy - unit test).
As far as I know mendix currently does not allow you to run your unit tests in the compile step of the application (like you would normally do with something like Maven), so this was the best solution we came up with.
I believe there is a API for the UnitTesting Module. Maybe that way you could automate it the way you want.
Check the documentation tab :