I have main.xml as follows:
...
The AndroidApplication class (which extends activity) has a method named initializeForView(ApplicationListener, AndroidApplicationConfiguration)
that will return a View
you can add to your layout.
So your Test-class can extend AndroidApplication instead of Activity so that you can call that method and add the View to your layout.
If that's not an option, for some reason, take a look at what AndroidApplication source code does, and mimic that.