Thank you for your question.
I suppose the issue is coming from the code-behind file which you have included in your project and cannot be loaded.
As I want to understand the issue in detail. I would like to ask you if you have reviewed the Test Modularization
article and more specific using code section
It would be very beneficial for you to check out Add Existing Code File
In addition I would like to ask you to generate application log
on the faulty execution so I could be able to investigate further the issue.
Thank you for cooperating in advance!