Masquerade doesn't have to be in the same project as the Jmix application.
This should be mentioned in the documentation.
To create a separate project with Masquerade, simply create an empty Java project in Gradle and add the dependency:
testImplementation('io.jmix.masquerade:jmix-masquerade:{VERSION}')