A bit unclear what your goal is of viewing/exporting the code. But here some pointers;
At first, the model is interperted by the Mendix runtime when running the app. Thus Mendix does not generate code.
However, you can use the Model SDK to create, export and analyse models. But you will not be able to read the full source code.
https://docs.mendix.com/apidocs-mxsdk/mxsdk/sdk-intro/
If you want to test the application, this can be done in various ways
https://docs.mendix.com/howto/testing/
And by using the model SDK you can create your own approach.
Hope this helps