Hi Brian, 

I'll outline what seemed to be the issue. I'm in the process of writing a 
testframework based on MBUnit, but I'm mainly exploring possible solutions 
at this point. 

The structure I had made was a DynamicFactory that would make a call down 
in an underlying structure for a number of TestSuites to be executed. It 
would then yield return each TestSuite. The TestSuite would contain a 
number of TestCases, each initialized with their own Webdriver instance 
combined in such a way that every TestCase would be executed once with each 
supported browser.
It worked, but it didn't ran in parallel. 
The change I made was simply moving the structure that made the TestSuites 
available into a TestSuiteFactory, which would then be returning an 
object[] containing each TestSuite and a WebDriver instance. This made 
parallel execution possible. I did however encounter some issues with 
parallel execution that I haven't been able to resolve yet. 

But to spell it out, the difference is:
Sequential execution: 
[DynamicTestFactory, Parallelizable]
        public IEnumerable<Test> ExecuteTests()
             foreach (TestSuite suite in GetTestSuite())
                  yield return suite;

Parallel execution
[DynamicTestFactory, Parallelizable]
        [Factory(typeof(FactoryDataProvider), "ProvideData")]
        public IEnumerable<Test> ExecuteTests(TestSuite suite, IWebDriver 
driver)
        {
            yield return suite;
        }

Where the "ProvideData" method is roughly equal to the "GetTestSuite" 
method. 

Den onsdag den 7. november 2012 19.22.22 UTC+1 skrev Brian George:
>
> Glad to help.  Care to share your solution?  I'm always anxious to learn 
> something new.
>
> b
>
> On Tuesday, November 6, 2012 2:23:31 AM UTC-8, Mikkel Pedersen Kaas wrote:
>>
>> The answer didn't exactly reflect my issue, but it got me thinking and 
>> after a few tests with various setups I got it working. Thanks a lot Brian:)
>>
>> Den mandag den 5. november 2012 18.41.42 UTC+1 skrev Brian George:
>>>
>>> In AssemblyInfo.cs:
>>> [assembly: DegreeOfParallelism(3)]
>>> [assembly: Parallelizable(TestScope.All)]
>>>
>>> In Test file:
>>> [TestFixture]
>>>     [Parallelizable]
>>>
>>>     public class PTest
>>>     {
>>>         string[] search = new string[3] { "maps", "beer", "shoping" };
>>>         [DynamicTestFactory]
>>>         [Row("Google")]
>>>         [Row("Yahoo")]
>>>         public IEnumerable<Test> CreateDynamicTests(string 
>>> searchProvider)
>>>         {
>>>             foreach (string searchTerm in search)
>>>             {
>>>                 yield return new TestCase("Search Term: " + searchTerm, 
>>> () =>
>>>                 {
>>>                     Console.WriteLine(DateTime.Now);
>>>                     Thread.Sleep(15000);
>>>                     Assert.IsNotNull(searchTerm);
>>>                 });
>>>             }
>>>         }
>>>     }
>>>
>>> I get the following results:
>>>
>>>    - PTest   
>>>    [image: Passed]8[image: Failed]0[image: Inconclusive or Skipped]0 
>>>    Duration: 45.233s, Assertions: 6. 
>>>     - CreateDynamicTests   
>>>       [image: Passed]8[image: Failed]0[image: Inconclusive or Skipped]0 
>>>       Duration: 45.200s, Assertions: 6. 
>>>        - CreateDynamicTests("Google")   
>>>          [image: Passed]4[image: Failed]0[image: Inconclusive or 
>>>          Skipped]0 
>>>          Duration: 45.037s, Assertions: 3. 
>>>           - Search Term: maps   
>>>             Duration: 15.023s, Assertions: 1. 
>>>              11/5/2012 9:37:23 AM
>>>             - Search Term: beer   
>>>             Duration: 15.000s, Assertions: 1. 
>>>              11/5/2012 9:37:38 AM
>>>             - Search Term: shoping   
>>>             Duration: 15.000s, Assertions: 1. 
>>>              11/5/2012 9:37:53 AM
>>>             - CreateDynamicTests("Yahoo")   
>>>          [image: Passed]4[image: Failed]0[image: Inconclusive or 
>>>          Skipped]0 
>>>          Duration: 45.036s, Assertions: 3. 
>>>           - Search Term: maps   
>>>             Duration: 15.023s, Assertions: 1. 
>>>              11/5/2012 9:37:23 AM
>>>             - Search Term: beer   
>>>             Duration: 15.000s, Assertions: 1. 
>>>              11/5/2012 9:37:38 AM
>>>             - Search Term: shoping   
>>>             Duration: 15.000s, Assertions: 1. 
>>>              11/5/2012 9:37:53 AM
>>>             
>>> It shows 2 tests running at the same time.
>>>
>>> Brian
>>>
>>> On Monday, November 5, 2012 2:34:45 AM UTC-8, Mikkel Pedersen Kaas wrote:
>>>>
>>>> I've had a paralleled version in the past, but now that I'm rewriting 
>>>> it, it doesn't seem to be working anymore. 
>>>>
>>>> I'm using a [DynamicTestFactory], within which I'm creating a 
>>>> TestSuite. I then add additional TestSuites and TestCases to it. It's 
>>>> these 
>>>> tests that I'd like to execute in parallel, but I'm unsure of how to go 
>>>> about it. 
>>>>
>>>> Den onsdag den 31. oktober 2012 23.50.13 UTC+1 skrev Brian George:
>>>>>
>>>>> In the AssemblyInfo.cs file: 
>>>>> [assembly: DegreeOfParallelism(3)]
>>>>> [assembly: Parallelizable(TestScope.All)]
>>>>>
>>>>> Also be sure to add [Parallelizable] to your TestFixture
>>>>>
>>>>>
>>>>> http://www.seleniumwiki.com/software-testing/selenium-grid/installing-selenium-grid-with-mbunit-and-gallio
>>>>>  
>>>>>
>>>>> Brian
>>>>>
>>>>>
>>>>> On Monday, October 29, 2012 3:55:45 AM UTC-7, Mikkel Pedersen Kaas 
>>>>> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm using Selenium and c# to make some, for the time being, simple 
>>>>>> tests of a few webpages. Right now I'm using a DynamicTestFactory to 
>>>>>> create 
>>>>>> a test for each page with each different browser that we aim to support. 
>>>>>> My 
>>>>>> problem is, that I can't figure out how to make the tests generated by 
>>>>>> the 
>>>>>> DynamicTestFactory execute in parallel. Is there anyone that can shed 
>>>>>> some 
>>>>>> light on the issue? Thank you. 
>>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/mbunituser/-/r3a9L3XAJPYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/mbunituser?hl=en.

Reply via email to