1) XML
- , NUnit 2.6.3 (, , 2.6.4 allure ), - http://www.nunit.org/index.php?p=download
- allure NUnit - https://github.com/allure-framework/allure-nunit/releases
- %NUnit_installation_directory%\bin\addins ( - C:\Program Files (x86)\NUnit 2.6.3\bin\addins)
- config.xml <results-path> , ( )
- NUnit GUI nunit-console, .NET 4.0 (, nunit-console YourAssembly.dll /framework=net-4.0)
- , , <results-path>
2) xml
- allure-cli - https://github.com/allure-framework/allure-cli/releases/tag/allure-cli-2.3
- jdk - http://www.oracle.com/technetwork/java/javase/downloads/index.html
- JAVA_HOME, jdk, - C:\Progra~1\Java\jdk1.8.0_31 ( - https://confluence.atlassian.com/display/DOC/Setting+the+JAVA_HOME+Variable+in+Windows)
- allure-cli
- bin, run.cmd, :
allure.bat generate -v 1.4.1 D:\test-results-allure\
pause
D:\test-results-allure\ xml ,
- run.cmd
- bin allure-report, index.html,
Page Object
Page Objects . , , .
Page Objects:
1. : - Page Objects,
2. DRY . UI ,
3. . . , , : , PhantomJS, - WebDriver, . , Page Objects.
|
|
4. Page Objects
- http://habrahabr.ru/post/155109/ - https://github.com/DmitryRoss/Page-Object-Model-Article
:
- BaseObject, :
public class BaseObject
{
public static RemoteWebDriver Driver;
public static DefaultSelenium Selenium;
public static void InitPage<T>(T pageClass) where T: BaseObject
{
PageFactory.InitElements(Driver, pageClass);
}
}
- BaseTest, BaseObject. TestFixtureSetUp, TestFixtureTearDown, SetUp, TearDown. TestFixtureSetUp , TestFixtureTearDown , SetUp , TearDown , .
- Utils ( BaseObject) , , - , ( )
( ):
1) LoginPage ( BaseObject)
:
- : public const string USER_NAME_TEXT_FIELD = "//input[@id='login']";
- = :
[FindsBy(How = How.XPath, Using = USER_NAME_TEXT_FIELD)]
public IWebElement userNameTextField;
- :
public static LoginPage GetLoginPage()
{
LoginPage loginPage = new LoginPage();
InitPage(loginPage);
return loginPage;
}
- :
public LoginPage TypeUserName(string userName)
{
userNameTextField.SendKeys(userName);
return GetLoginPage();
}
2) helper ( ) - LoginHelper
:
- ():
private LoginPage loginPage = new LoginPage();
- , :
public LoginHelper DoLogin(string userName, string password)
{
BaseObject.InitPage(loginPage);
loginPage.LogOff().
TypeUserName(userName).
TypePassword(password).
ClickLoginButton();
return this;
}
3) LoginTest
:
- helper:
private static LoginHelper loginHelper = new LoginHelper();
- ( helper):
[Test]
public static void AssertLogin()
{
string userName = "admin";
string password = "";
string displayedUserName = "";
string Welcome_text = " ELMA!";
loginHelper.
DoLogin(userName, password).
AssertUserName(displayedUserName).
AssertHomePage(Welcome_text);
}
4) ( , Utils) - LoginUtils