This is a migrated thread and some comments may be shown as answers.

Must reload test .dll in Nunit after each test runs (v2011.2.1117.0)

7 Answers 132 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 24 Jan 2012, 09:17 PM
Hi,

I just upgraded to the latest webaii .dlls v2011.2.117.0. Nothing else has changed on my system. For some reason, from Nunit, I now must reload the project after a single test runs or I'll get a reflection exception. I have several tests and we run them in suites, so resetting the project after each test is not going to work. Please help me work through this issue as it could be something on my end, but this wasn't repro'ing at all before I changed the webaii bits.

Config: Win7 x64, Firefox 8 and IE 9, webaii 2011.2.117.0, Nunit x86 2.5.11092 x86

Thanks,
Chris C

7 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 25 Jan 2012, 06:20 PM
Any thoughts on this?
0
Plamen
Telerik team
answered on 25 Jan 2012, 07:46 PM
Hello Chris,

I wasn't able to reproduce the problem. What is the exact error message you are getting on the second run? I've installed the same version of Nunit and created a simple test. As you can see in this video, the test runs multiple times without any problems.

Please create a simple test(against Google for example) and see if you can reproduce this behavior. Also, provide the error log, so we can look further into this. 

All the best,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chris
Top achievements
Rank 1
answered on 25 Jan 2012, 09:05 PM
No, it doesn't repro with the simple test for me either. This is very strange since the telerik bits were the only thing I upgraded. It's also strange since tests within a single class run completely/correctly on the first run after loadign the .dll. 

Repro:
1. Load test project with multiple classes in Nunit
2. Check a single test in 2 separate classes and run
3. Notice 2nd test fails to run with the following error:
"(TestFixtureSetUp): SetUp : System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."
4. Attempt to run tests again and notice the same failure from step 3

I can only get another successful run if I reload the project .dll and only select tests from a single class during a run.
0
Plamen
Telerik team
answered on 26 Jan 2012, 05:48 PM
Hi Chris,

Thank you for the provided reproduction steps. I wasn't able to get the exact same error, but I've managed to reproduce a similar behavior.

Here are some things you can try to overcome this problem:
  1. Check if you are using a TestFixtureSetUp attribute inside of a TestFixture(see screenshot). If you have that attribute, try to replace it with the SetUp attribute. The main difference between these two attributes is that TestFixtureSetUp provides a single set of functions that are performed once prior to executing any of the tests in the fixture, while SetUp provides a set of functions that are performed just before each test method is called.
  2. According to one of our developers, the only thing that is changed recently in our NUnit template is that the RecycleBrowser property is set to False by default, which can cause problems if you are not launching a new browser instance at the beginning of the second test. If that is the case, you can simply set it to true as seen in the screenshot.
  3. According to Google this error is usually caused by the fact that one of the assemblies in the solution cannot be loaded (there is some missing reference or runtime dependency, or there is some security issue with loading the assembly), so please check that too.

Check this video for more information on options 1 & 2. 

If this doesn't help, please put together a sample executable project and send it to us, so we can reproduce the problem locally and try to find a working solution for you. 

Hope to hear from you soon.

All the best,

Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chris
Top achievements
Rank 1
answered on 02 Feb 2012, 12:23 AM

1. We have several test classes which all point to one automation test base class in order to share as much generic code as possible.

We are using an automation setup fixture as follows:

[SetUpFixture]

            public class AutomationSetupFixture : BaseTest

            {

                        [SetUp]

                        public void SuiteSetUp()

                        {

Then the setup and cleanup methods live in an automation test base class which gets called from the test methods. Each method has the following:

            [TestFixture]

            public class CBSTests : UIAutomationTestBase

            {

[TestFixtureSetUp]

                        public void SomeTestSetup()

                        {

                                    automationTestBaseMethod.Setup();

2. We do not recycle the browser.

3. It seems some shadow file is getting dropped into a temp dir after the first run. We don’t know how or why though. We may have to roll back the webaii .dlls which also means we’d also have to roll back the browser versions. This is undesirable since we really needed to update the browser. However, all of our UI automation is failing during the nightly runs. Locally, it was just the original issue listed in this thread. But on the build machine during the nightly run, there’s an automation setup fixture which is failing with the following:

“Parent SetUp failed in AutomationSetupFixture

 

Parent SetUp failed in AutomationSetupFixture

GroupCommerce.Tests.UIAutomation.AutomationSetupFixture (TestFixtureSetUp):

SetUp : ArtOfTest.WebAii.Exceptions.FindException : Find Details:

- FindParam used: [Find logic: Use 'TagIndex' where tag 'title' has index '0' and (none) ]

- Start Element: [Element: '#comment#:-1']

  ----> System.ArgumentException : Start reference has to be a valid element and not an EndTag

Parameter name: Reference”

I'm not sure what changed to cause these issues. I even tried switching from NUnit to MSTest, but we have the same issues with MSTest.

0
Chris
Top achievements
Rank 1
answered on 02 Feb 2012, 12:41 AM
Btw, changing TestFixtureSetUp attribute inside of the test methods to SetUp didn't fix the issue.
0
Plamen
Telerik team
answered on 06 Feb 2012, 03:34 PM
Hello Chris,

Unfortunately I'm still unable to replicate the original issue. We really need a sample project to reproduce the issue locally and find out what causes the reflection exception.

For the second problem, I've seen this error only twice before and it was a browser specific problem. Did you try to execute your test in a different browser? Please configure your browser according this documentation and try to disable all browser Add-ons as seen near bottom of this article("Temporarily disable all Internet Explorer add-ons"). Also, here's a discussion on a similar problem.

Kind regards,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or