2014-08-30 11 views
11

Chcę przeprowadzić testy pararell w Browserstack. To jest mój projekt testowyUruchamianie testu równoległego z PNunit, nie można odczytać z pliku konfiguracyjnego

RTest (Jednostka projekt testowy w VS 2013)

-UnitTest1.cs

-RTest.config

otworzyć NUnit i przejdź do mojego dll bin/debug/RTest.dll i Nunit znajdzie mój przypadek testowy

problem plik My RTest.config wygląda następująco:

<TestGroup> 
    <ParallelTests> 
     <ParallelTest> 
     <Name>Testing</Name> 
     <Tests> 
      <TestConf> 
      <Name>TestFF-20-Win8</Name> 
      <Assembly>RTest.dll</Assembly> 
      <TestToRun>RTest.UnitTest1.TestCase</TestToRun> 
      <Machine>localhost:8080</Machine> 
      <TestParams> 
       <string>firefox</string> <!--browserName --> 
       <string>20.0</string> <!-- version --> 
       <string>Windows</string><!-- os --> 
       <string>8</string><!-- os_version --> 
      </TestParams> 
      </TestConf> 
      <TestConf> 
      <Name>TestFF-21-win7</Name> 
      <Assembly>RTest.dll</Assembly> 
      <TestToRun>Test.UnitTest1.TestCase</TestToRun> 
      <Machine>localhost:8080</Machine> 
      <TestParams> 
       <string>firefox</string> 
       <!--browserName --> 
       <string>21.0</string> 
       <!-- version --> 
       <string>Windows</string> 
       <!-- os --> 
       <string>7</string> 
       <!-- os_version --> 
      </TestParams> 
      </TestConf> 
     </Tests> 
     </ParallelTest> 
    </ParallelTests> 
</TestGroup> 

Moi UnitTest1.cs wygląda następująco:

using NUnit.Framework; 
using PNUnit.Framework; 
using System; 
using System.Web; 
using System.Text; 
using System.Net; 
using OpenQA.Selenium; 
using OpenQA.Selenium.Remote; 

namespace RTest 
{ 
    [TestFixture()] 
    public class UnitTest1 
    { 
     private IWebDriver driver; 
     private string[] testParams; 

     [SetUp] 
     public void Init() 
     { 
      testParams = PNUnitServices.Get().GetTestParams(); 
      String params1 = String.Join(",", testParams); 
      Console.WriteLine(params1); 
      String browser = testParams[0]; 
      String version = testParams[1]; 
      String os = testParams[2]; 
      String os_version = testParams[3]; 
      DesiredCapabilities capability = new DesiredCapabilities(); 
      capability.SetCapability("browserName", browser); 
      capability.SetCapability(CapabilityType.Version, version); 
      capability.SetCapability("os", os); 
      capability.SetCapability("os_version", os_version); 
      capability.SetCapability("browserstack.user", "testUser"); 
      capability.SetCapability("browserstack.key", "testPW"); 

      Console.WriteLine("Capabilities" + capability.ToString()); 

      driver = new RemoteWebDriver(new Uri("http://hub.browserstack.com:80/wd/hub/"), capability); 
     } 

     [Test] 
     public void TestCase() 
     { 
      driver.Navigate().GoToUrl("http://www.google.com"); 
      StringAssert.Contains("Google", driver.Title); 
      IWebElement query = driver.FindElement(By.Name("q")); 
      query.SendKeys("Browserstack"); 
      query.Submit(); 
     } 

     [TearDown] 
     public void Cleanup() 
     { 
      driver.Quit(); 
     } 
    } 
} 

Kiedy uruchomić mój test I odbieranie mInstance jest null ...... Co robię źle tutaj?

+0

Nikt, kto może mi pomóc tutaj? – user3624378

+0

Gdzie możesz rozwiązać problem? –

Odpowiedz

0

Spróbuj zmienić nazwę RTest.config na test.conf.