-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance Improvement - Selective In Domain Execution #21
Comments
On 2016.10.25 01:37 @rubenhak modified issue: |
On 2016.10.25 21:17, @zastrowm commented: Are you proposing:
Feel free to choose more than one :: ) |
On 2016.10.25 21:27, @rubenhak commented:
I personally do not see a need for sharing data across tests, but if needed, then the current method of sharing data should work just well. And of course, all above to be a selective behavior, maybe with some attribute, or an argument to RunInApplicationDomain attribute. |
On 2016.10.26 20:36, @zastrowm commented: |
On 2016.10.26 21:17, @rubenhak commented: |
On 2016.10.30 23:31, @zastrowm commented: I wouldn't be opposed to including something that allows the app-domain to be customized, but only if someone who is using app domains would want to use the feature. I am currently leaning along the lines of what you said, specifying a type to actually construct the appdomain: [RunInAppDomain(AppDomainFactory=typeof(MyDomainFactory))]
public void MyTest()
{
}
...
public class MyDomainFactory : IAppDomainFactory
{
AppDomain IAppDomainFactory.GetAppDomainFor(Test test, ...)
{
...
}
void IAppDomainFactory.MarkTestFinished(AppDomain domain, Test test, ...)
{
...
}
} Would that work for you? Also, is the reason that you want a new test instance every time so that the constructor always runs? If so, you could also use reflection to re-invoke the constructor (I'm just mentioning it in case it does what you want). |
On 2016.10.30 23:42, @rubenhak commented: |
On 2016.10.30 23:44, @rubenhak commented: ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); |
On 2016.11.14 22:16, @zastrowm commented: |
On 2016.11.14 22:19, @zastrowm commented: public class MyDomainFactory : IAppDomainFactory
{
AppDomain IAppDomainFactory.GetAppDomainFor(Test test, ...)
{
return AppDomain.Current;
}
void IAppDomainFactory.MarkTestFinished(AppDomain domain, Test test, ...)
{
// no need to do anything, it's already ready
}
} In short, it's a way to provide "custom" app-domains via whatever mechanism the developer chooses, which is why I like it. |
On 2017.07.26 22:23, @zastrowm commented: |
On 2017.07.26 22:23 @zastrowm modified issue: |
On 2017.07.26 23:34, @rubenhak commented: |
Issue created by @rubenhak as Bitbucket Issue #21 on 2016.10.25 01:37.
Hi,
First of all want to tell you that NUnit.ApplicationDomain solves a big problem with isolating testing environment. I've been using it for couple of weeks now and it was very helpful. Now I'm hitting a different kind of issue - performance. I heavily rely on TestFixtures and TestCasses that already produced 4K test cases. I've noticed that creation and unload of 4K AppDomains increases the test run time from 2 minutes to 20 minutes. Here is my proposal:
In some cases full app domain isolation is not needed. I designed my software so that there is almost no global state, and the global state I can isolate internally using "some magic namespaces". But when test case instances are holding lots of state that is specific to individual test run. So for every test run within the test fixture I needed a separate instance, just like that way it is done in NUnit.ApplicationDomain. So, I'm thinking about a way to reuse the work done and for certain tests still create new instance of test object, but execute it in the default app domain.
I put together a prototype by just commenting out AppDomain creation, instanciated InDomainTestMethodRunner and just executing the methodData. One extra trick was needed. The test instance should have information whether it is a original instance, or the cloned one. One way is to implement the interface:
And after creating the copy:
The text would return from [Init] and [CleanUp] if the call was make for the instance which was not set to be Executable.
Basically this is the rough idea. It would be very nice to have this functionality. Let me know if you see value in this and we can collaborate.
Cheers,
Ruben
The text was updated successfully, but these errors were encountered: