-
Notifications
You must be signed in to change notification settings - Fork 50
Golem.WebDriver, Getting Started
===== ###Guide Navigation
=====
###Selenium WebDriver C# Framework
Selenium WebDriver is collection of language specific bindings used to drive browser actions natively the way a real user would. Combined with the Golem’s Core functionality, you now have a powerful tool to create and execute robust, browser-based test automation scripts.
By default, the framework will automatically launch Firefox on your local browser before each test, and instantiates a WebDriver instance. The Config class or an App.Config file can be used to control which browsers are used during testing.
Golem includes a variety of features that can globally enabled for every test. For example, having each WebDriver command written to the test log.
=====
###Creating a Test
- Create a new Class Library by selecting File > New > Project > Class Library.
- Right click on References > Manage NuGet Packages
- Add package “ProtoTest.Golem”.
- Use the "driver." property to use a direct WebDriver command.
- Paste the following code into your class file, save the project/solution, and build:
using MbUnit.Framework;
using ProtoTest.Golem.Tests.PageObjects.Google;
using ProtoTest.Golem.WebDriver;
namespace ProtoTest.Golem.Tests
{
class Test : WebDriverTestBase
{
[Test]
public void TestGoogle()
{
OpenPage<GoogleHomePage>("http://www.google.com/").SearchFor("Selenium").VerifyResult("Web Browser Automation");
}
}
}
=====
- Add an "Application Configuration File".
- Edit the App.config -> Set browser using key “Browser1” value=”Firefox”
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Browser1" value="Firefox"/>
</appSettings>
</configuration>
- Execute Test - Should open Firefox instead of Chrome.
- Supports Firefox, Chrome, IE, Safari, HtmlUnit, and Android (remote only)
[FixtureInitializer]
public void init()
{
Config.Settings.httpProxy.startProxy = false;
Config.Settings.httpProxy.useProxy = false;
}
=====
- TestDriven.net plugin is required
- Right Click on Test > Run Test (Should open browser and close it)
- Right Click on Class or project to run all tests within.
- Open Gallio Icarus
- Click "Add" and navigate to our ProjectName.dll file located in the /bin/release or /bin/debug/ directory.
- Select tests to execute.
- Click Run.
####Executing on a Remote Computer:
- Modify App Config, set host to IP or Hostname of remote computer
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Browser1" value="Chrome"/>
<add key="RunOnRemoteHost" value="True"/>
<add key="HostIp" value="10.10.1.151"/>
</appSettings>
</configuration>