Skip to content

Commit 18a5ac8

Browse files
Creation of the project
1 parent ee84611 commit 18a5ac8

File tree

89 files changed

+204792
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+204792
-0
lines changed
Binary file not shown.

Tutorial parallel execution/.vs/config/applicationhost.config

Lines changed: 1022 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tutorial parallel execution", "Tutorial parallel execution\Tutorial parallel execution.csproj", "{34BB1296-F0E2-4BF4-A7F7-7935B1F498CB}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{34BB1296-F0E2-4BF4-A7F7-7935B1F498CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{34BB1296-F0E2-4BF4-A7F7-7935B1F498CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{34BB1296-F0E2-4BF4-A7F7-7935B1F498CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{34BB1296-F0E2-4BF4-A7F7-7935B1F498CB}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using OpenQA.Selenium;
2+
using OpenQA.Selenium.Remote;
3+
4+
namespace Tutorial_parallel_execution
5+
{
6+
7+
public class Base
8+
{
9+
public bool remoteOrLocal = true;
10+
public IWebDriver Driver { get; set; }
11+
}
12+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
using NUnit.Framework;
2+
using OpenQA.Selenium.Chrome;
3+
using OpenQA.Selenium.Firefox;
4+
using OpenQA.Selenium.Remote;
5+
using System;
6+
7+
namespace Tutorial_parallel_execution
8+
{
9+
public enum BrowserType
10+
{
11+
Chrome,
12+
Firefox,
13+
IE,
14+
Opera
15+
}
16+
17+
public class Hooks : Base
18+
{
19+
private BrowserType _browserType;
20+
21+
public Hooks(BrowserType browser)
22+
{
23+
_browserType = browser;
24+
}
25+
26+
[SetUp]
27+
public void InitializeTest()
28+
{
29+
ChooseDriverInstance(_browserType);
30+
31+
}
32+
33+
private void ChooseDriverInstance(BrowserType browser)
34+
{
35+
if (remoteOrLocal == false)
36+
{
37+
if (browser == BrowserType.Chrome)
38+
{
39+
Driver = new ChromeDriver();
40+
}
41+
else if (browser == BrowserType.Firefox)
42+
{
43+
var driverService = FirefoxDriverService.CreateDefaultService();
44+
driverService.FirefoxBinaryPath = "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe";
45+
driverService.HideCommandPromptWindow = true;
46+
47+
Driver = new FirefoxDriver(driverService);
48+
Driver.Manage().Window.Maximize();
49+
}
50+
}
51+
else
52+
{
53+
DesiredCapabilities capability = new DesiredCapabilities();
54+
capability.SetCapability("platform", "WINDOWS");
55+
if (browser == BrowserType.Chrome)
56+
{
57+
capability = DesiredCapabilities.Chrome();
58+
}
59+
else if (browser == BrowserType.Firefox)
60+
{
61+
capability = DesiredCapabilities.Firefox();
62+
}
63+
else if (browser == BrowserType.Opera)
64+
{
65+
capability = DesiredCapabilities.Opera();
66+
}
67+
else if (browser == BrowserType.IE)
68+
{
69+
capability = DesiredCapabilities.InternetExplorer();
70+
}
71+
Driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capability);
72+
73+
}
74+
75+
}
76+
77+
}
78+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"port": 4444,
3+
"newSessionWaitTimeout": -1,
4+
"servlets": [ ],
5+
"withoutServlets": [ ],
6+
"custom": { },
7+
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
8+
"registry": "org.openqa.grid.internal.DefaultGridRegistry",
9+
"throwOnCapabilityNotPresent": true,
10+
"cleanUpCycle": 5000,
11+
"role": "hub",
12+
"debug": false,
13+
"browserTimeout": 0,
14+
"timeout": 1800
15+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"capabilities": [
3+
{
4+
"browserName": "firefox",
5+
"platform": "WINDOWS",
6+
"maxInstances": 5
7+
},
8+
{
9+
"browserName": "chrome",
10+
"platform": "WINDOWS",
11+
"maxInstances": 5
12+
},
13+
{
14+
"browserName": "opera",
15+
"platform": "WINDOWS",
16+
"maxInstances": 5
17+
},
18+
{
19+
"browserName": "internet explorer",
20+
"platform": "WINDOWS",
21+
"maxInstances": 5
22+
}
23+
],
24+
"configuration": {
25+
"nodeTimeout": 120,
26+
27+
"hubPort": 4444,
28+
"hubHost": "localhost",
29+
30+
"nodePolling": 2000,
31+
32+
"registerCycle": 10000,
33+
"register": true,
34+
"cleanUpCycle": 2000,
35+
"timeout": 30000,
36+
"maxSession": 5,
37+
}
38+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Tutorial parallel execution")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Microsoft")]
12+
[assembly: AssemblyProduct("Tutorial parallel execution")]
13+
[assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("34bb1296-f0e2-4bf4-a7f7-7935b1f498cb")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props')" />
4+
<Import Project="..\packages\NUnit.3.10.1\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" />
5+
<PropertyGroup>
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<ProjectGuid>{34BB1296-F0E2-4BF4-A7F7-7935B1F498CB}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>Tutorial_parallel_execution</RootNamespace>
12+
<AssemblyName>Tutorial parallel execution</AssemblyName>
13+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
16+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
17+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
18+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
19+
<IsCodedUITest>False</IsCodedUITest>
20+
<TestProjectType>UnitTest</TestProjectType>
21+
<NuGetPackageImportStamp>
22+
</NuGetPackageImportStamp>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25+
<DebugSymbols>true</DebugSymbols>
26+
<DebugType>full</DebugType>
27+
<Optimize>false</Optimize>
28+
<OutputPath>bin\Debug\</OutputPath>
29+
<DefineConstants>DEBUG;TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
34+
<DebugType>pdbonly</DebugType>
35+
<Optimize>true</Optimize>
36+
<OutputPath>bin\Release\</OutputPath>
37+
<DefineConstants>TRACE</DefineConstants>
38+
<ErrorReport>prompt</ErrorReport>
39+
<WarningLevel>4</WarningLevel>
40+
</PropertyGroup>
41+
<ItemGroup>
42+
<Reference Include="nunit.framework, Version=3.10.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
43+
<HintPath>..\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll</HintPath>
44+
<Private>True</Private>
45+
</Reference>
46+
<Reference Include="System" />
47+
<Reference Include="System.Drawing" />
48+
<Reference Include="WebDriver, Version=3.12.1.0, Culture=neutral, processorArchitecture=MSIL">
49+
<HintPath>..\packages\Selenium.WebDriver.3.12.1\lib\net45\WebDriver.dll</HintPath>
50+
<Private>True</Private>
51+
</Reference>
52+
</ItemGroup>
53+
<Choose>
54+
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
55+
<ItemGroup>
56+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
57+
</ItemGroup>
58+
</When>
59+
<Otherwise>
60+
<ItemGroup>
61+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
62+
</ItemGroup>
63+
</Otherwise>
64+
</Choose>
65+
<ItemGroup>
66+
<Compile Include="Base.cs" />
67+
<Compile Include="Hooks.cs" />
68+
<Compile Include="UnitTest1.cs" />
69+
<Compile Include="Properties\AssemblyInfo.cs" />
70+
</ItemGroup>
71+
<ItemGroup>
72+
<None Include="HubConfiguration.json" />
73+
<None Include="NodeConfiguration.json" />
74+
<None Include="packages.config" />
75+
</ItemGroup>
76+
<Choose>
77+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
78+
<ItemGroup>
79+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
80+
<Private>False</Private>
81+
</Reference>
82+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
83+
<Private>False</Private>
84+
</Reference>
85+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
86+
<Private>False</Private>
87+
</Reference>
88+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
89+
<Private>False</Private>
90+
</Reference>
91+
</ItemGroup>
92+
</When>
93+
</Choose>
94+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
95+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
96+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
97+
<PropertyGroup>
98+
<ErrorText>Este projeto faz referência a pacotes do NuGet que não estão presentes neste computador. Use a Restauração de Pacotes do NuGet para baixá-los. Para obter mais informações, consulte http://go.microsoft.com/fwlink/?LinkID=322105. O arquivo ausente é {0}.</ErrorText>
99+
</PropertyGroup>
100+
<Error Condition="!Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.10.1\build\NUnit.props'))" />
101+
<Error Condition="!Exists('..\packages\Selenium.Chrome.WebDriver.2.38\build\Selenium.Chrome.WebDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.Chrome.WebDriver.2.38\build\Selenium.Chrome.WebDriver.targets'))" />
102+
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props'))" />
103+
<Error Condition="!Exists('..\packages\Selenium.WebDriver.GeckoDriver.0.20.1\build\Selenium.WebDriver.GeckoDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.GeckoDriver.0.20.1\build\Selenium.WebDriver.GeckoDriver.targets'))" />
104+
</Target>
105+
<Import Project="..\packages\Selenium.Chrome.WebDriver.2.38\build\Selenium.Chrome.WebDriver.targets" Condition="Exists('..\packages\Selenium.Chrome.WebDriver.2.38\build\Selenium.Chrome.WebDriver.targets')" />
106+
<Import Project="..\packages\Selenium.WebDriver.GeckoDriver.0.20.1\build\Selenium.WebDriver.GeckoDriver.targets" Condition="Exists('..\packages\Selenium.WebDriver.GeckoDriver.0.20.1\build\Selenium.WebDriver.GeckoDriver.targets')" />
107+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
108+
Other similar extension points exist, see Microsoft.Common.targets.
109+
<Target Name="BeforeBuild">
110+
</Target>
111+
<Target Name="AfterBuild">
112+
</Target>
113+
-->
114+
</Project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using NUnit.Framework;
3+
using OpenQA.Selenium;
4+
5+
namespace Tutorial_parallel_execution
6+
{
7+
[TestFixture(BrowserType.Chrome)]
8+
[TestFixture(BrowserType.Firefox)]
9+
[TestFixture(BrowserType.Opera)]
10+
[TestFixture(BrowserType.IE)]
11+
[Parallelizable(ParallelScope.Fixtures)]
12+
public class GoogleTesting : Hooks
13+
{
14+
public GoogleTesting(BrowserType browser) : base(browser)
15+
{
16+
17+
}
18+
19+
[Test]
20+
public void GoogleTest()
21+
{
22+
Driver.Navigate().GoToUrl("http://www.google.com");
23+
Driver.FindElement(By.Name("q")).SendKeys("selenium");
24+
Driver.FindElement(By.Name("btnK")).Click();
25+
Assert.That(Driver.PageSource.Contains("Selenium"), Is.EqualTo(true),
26+
"The text selenium doenst exist");
27+
}
28+
}
29+
30+
}

0 commit comments

Comments
 (0)