Fitnesse/Appium/Selenium - .Fitnesse/Appium/Selenium ... Lead Test Automation Engineer – Client

  • View
    219

  • Download
    0

Embed Size (px)

Text of Fitnesse/Appium/Selenium - .Fitnesse/Appium/Selenium ... Lead Test Automation Engineer...

  • Fitnesse/Appium/SeleniumHerb Scruggs Lead Test Automation Engineer Client Resources Inc

  • Automation

    Why YOU should Automate Tests

    Manual Testing of all work flows, all fields, all negative scenarios is time and cost consuming

    Automation does not require Human intervention. You can run automated test unattended (overnight)

    Automation increases speed of test execution

    Automation helps increase Test Coverage

    Manual Testing can become boring and hence error prone.

    Free up time for exploratory testing for manual testers

  • Automation

    Keywords Selenium software to test web browsers Appium software to test mobile apps/web Fitnesse software to test the api API business logic layer of the application Jenkins Continuous Integration Server Maven build automation tool. TestNG testing framework TestRail Test Repository URI Universal Resource Identifier

  • Automation

    Types of Testing Covering Graphical User Interface (GUI) testing Selenium and Appium

    API driven Testing - Fitnesse

  • Fitnesse Born in 2001 Written in Java The core is written in Java, but it allows fixtures to be created in many different languages.

    What is it Fully integrated standalone wiki and acceptance testing framework In general, developers can write fixtures that allow non-coders to provide input/output against the

    fixtures for results. CRI uses a RestFixture by SmartRics for testing Rest API https://github.com/smartrics/RestFixture

  • Why use Fitnesse for API?

    6

    The REST Fixture is simple to use BA/QA can write the the tests with little dev help Validate HTTP responses, Headers and Body Uses a Wiki syntax so no need to know a programming language Create Suites of Tests for different version of your API Tests

  • What does the RestFixutre look like?

    7

    How to Start nohup java -jar lib/fitnesse-standalone.jar -p 9091 &

    RestFixture is super easy to use: |VERB|uri|?ret|?headers|?body| VERB = GET/PUT/POST/DELETE URI is the URI string of the request The Next 3 (?) are what comes back from the API call, the http response

    code, headers and body

  • Real World Example

    8

    Example Code|VERB|uri|?ret|?headers|?body|

    |Table:smartrics.rest.fitnesse.fixture.RestFixture|http://jsonplaceholder.typicode.com/posts||GET| /1 | 200 | | |

  • Fitnesse Demo Standalone with Testrails

    9

  • How Does CRI Implement?

    10

  • Fitnesse Demo Jenkinswith Testrails

    11

  • Appium Born in 2011 Developer origins from Zoosk Name = Selenium for Apps Founder of Selenium played role in getting Appium open sourced http://appium.io/history.html?lang=en 1.0 Stable release in 2014 Currently 1.5 Full developer support from Sauce Labs

    What is it Open-source tool for automating native, mobile web, and hybrid applications on iOS and Android

    platforms. Built upon Node.js framework. "cross-platform": it allows you to write tests against multiple platforms (iOS, Android), using the same

    API. Great for developing Smoke tests of web applications and regression suites

  • Languages Appium Client Libraries

    JavaC#RubyPythonJavascript (Node)PHPhttp://appium.io/downloads.html

  • Selenium Born in 2004 Developer origins from Thoughtworks/Google/Facebook http://www.seleniumhq.org/about/history.jsp 1.0 Core, IDE, Remote Control (RC) - Thoughtworks 2.0 Webdriver, Grid - Google 3.0 beta Removed Remote Control interface Google/Facebook

    What is it Open Source Browser based Test Automation software Automate Browsers for testing, but not limited to Great for developing Smoke tests of web applications and regression suites Has support of the some of the largest browser vendors

  • Why use Selenium?

    15

    Selenium has the capability to operate on almost every OS

    Open source testing tool and hence it serves for cost-effective automation testing

    Supports multiple languages Supports a range of browser Very dynamic developer community

    that is backed by Google Robust methods for location of

    elements ClassName Id Name XPath LinkText Partial LinkText CSS

    Convenient to implement frameworks that revolve around Object oriented programming like Keyword Driven, Data driven and Hybrid

    Integrates nicely with of open source frameworks like TestNG, JUnit, Nunit

    Execute simultaneous tests against different browsers

    Docker containers available for Firefox and Chrome

  • Browsers Most Common but not limited to

    IEFirefoxChromeSafarihttp://www.seleniumhq.org/download/

    Languages Supported but not limited to

    JavaC#RubyPythonJavascript (Node)http://www.seleniumhq.org/download/

  • How Does CRI Implement?

    17

  • Maven Pom Dependencies

    org.testngtestng6.9.10

    org.seleniumhq.seleniumselenium-java2.53.0

    io.appiumjava-client4.1.2

  • Maven Pom TestNG

    src/main/java

    org.apache.maven.pluginsmaven-surefire-plugin2.19.1

    src/test/resources/testng.xml

  • TestNG

  • TestNG

  • Programmatically Start Appiumpublic static void AppiumService(ITestContext context) {

    DesiredCapabilities serverCapabilities = new DesiredCapabilities();serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,

    context.getCurrentXmlTest().getParameter("platformName"));serverCapabilities.setCapability(MobileCapabilityType.FULL_RESET, false);serverCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60);

    AppiumService = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withCapabilities(serverCapabilities)

    .withIPAddress("127.0.0.1")

    .withArgument(GeneralServerFlag.SESSION_OVERRIDE)

    .withArgument(GeneralServerFlag.LOG_LEVEL, context.getCurrentXmlTest().getParameter("appiumLogLevel")));

    AppiumService.start();}

  • Page Factory Object@FindBy(how = How.XPATH, using = "//input[@aria-label='UserID']")@iOSFindBy(id = "loginTextField")public WebElement UserName;

    @AndroidFindAll({@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\")")

    })public List UserNamePassword;

    @FindBy(how = How.XPATH, using = "//input[@aria-label='Password']")@iOSFindBy(id = "passwordTextField")public WebElement PassWord;

    @FindBy(how = How.XPATH, using = "//button[@aria-label='LoginButton']")@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"com.ccnew.android.qa:id/login_button\")")@iOSFindBy(id = "LoginCell")public WebElement LoginButton;

  • Example Login Using Page Factory ElementsLogin = new LoginPageObjects(driver);PageFactory.initElements(new AppiumFieldDecorator(driver), Login);public void login() throws Exception {

    if (Utils.getBrowserType().contains("ANDROID")) {type(UserName, getUsername());type(PassWord, getPassword());driver.navigate().back();click(LoginButton);

    } else {waitForVisibilityOfElement(ContactUs);type(UserName, getUsername());type(PassWord, getPassword());

    }click(LoginButton);

    }

  • @BeforeClass(alwaysRun = true)public void beforeClass(ITestContext context)

    throws ClassNotFoundException {driver = Utils.getDriver(context);Login = new LoginPageObject(driver);//If MobilePageFactory.initElements(new

    AppiumFieldDecorator(driver), Login);//If BrowserPageFactory.initElements(driver, Login);

    }@Test(priority = 10, groups = {"smokeTests"})public void login(ITestContext context) throws

    Exception {Login.login();

    }

    @Test(priority = 20, groups = {"smokeTests"})public void testTwo(ITestContext context)

    throws Exception {Login.logout(context);

    }@AfterMethod(alwaysRun = true)

    public void afterMethod(ITestContext context, ITestResult result) {

    //Do something after every test?}@AfterClass(alwaysRun = true)public void afterClass(ITestContext context) {

    //This is where you close and tear down the driver}

  • Fitnesse + Appium + Selenium =

  • Questions

  • Thank You

    Herb Scruggs Lead Test Automation Engineer Client Resources Inchscruggs@clientresourcesinc.com