Testing Your Alfresco Add-ons

Slides:



Advertisements
Similar presentations
Tutorial 6 Creating a Web Form
Advertisements

Web based testing: Chucklist and Selenium
BY: KYLE ROGAHN COMPUTER SCIENCE SEMINAR UW PLATTEVILLE 4/3/2012 Web Browser Automation - Geb.
Automation using Selenium Authored & Presented by : Chinmay Sathe & Amit Prabhu Cybage Software Pvt. Ltd.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
© 2012 Boise State University1 WordPress Training February 14, 2013.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
User Extensions, RC and Web Driver Anton Angelov QA Engineer SystemIntegrationTeam Telerik QA Academy Telerik QA Academy.
ExtWebDriver Open Source Project Daniel Koo Latha Nagaraj Bryan Robbins 04/23/2014.
Software Quality Assurance QA Engineering, Testing, Bug Tracking, Test Automation Software University Technical Trainers SoftUni Team.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
© 2012 Boise State University1 WordPress Training February 14, 2013.
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Selenium and Selenium on Rails. Agenda  Overview of Selenium Simple Selenium Tests Selenium IDE  Overview of Selenium on Rails  Problems with Selenium.
And the PageObject Design Model.  How Selenium Remote Control works  You launch a server on your test machine.  Your tests connect to that server via.
Automated Smoke Testing on the JVM with Geb João SILVA (GS-AIS-EB) 1st Forum 29th of September, 2015 e-Business Section AUTOMATED SMOKE.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Lec 19 Web Driver 1 CSCE 747 Fall 2013 CSCE 747 Software Testing and Quality Assurance Lecture 19 Selenium Web Driver 11/4/
1 Presentation Title Test-driven development (TDD) Overview David Wu.
ScriptOnce™ & Best Practices. Agenda 2 Automation that works ScriptOnce –Minimal maintenance –Easy to add devices Robustness –Reliable Scripts - Minimize.
EFFECTIVE QA PROCESS FOR PVC Prepared by:PVC QA Team.
Test Automation Using Selenium Presented by: Shambo Ghosh Ankit Sachan Samapti Sinhamahapatra Akshay Kotawala.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Tata Consultancy Services1 WebDriver Basics Submitted By : Akhil K Gagan Deep Singh Naveenrajha H M Poornachandra Meduri Shubham Utsav Sunil Kumar G Vivek.
Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
QA Online Training In QA Click Academy. Selenium is a test automation framework used to test web applications such as browsers. It consists of different.
#SummitNow Load-testing Share Using the Benchmark Framework November 2013 Derek Hulley Michael Suzuki
Sqs.com SQS – the world’s leading specialist in software quality Please copy a slide with a suitable picture from the file „Title Slides_EN.pptx“ (change.
Load Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
© University of Liverpool
JavaScript, Sixth Edition
Selenium HP Web Test Tool Training
The Zen of UI Test Automation
Selenium and Selenium on Rails
Selenium HP Web Test Tool Training
How to Test a Complex ERP Application using a Data-Driven Framework
Testing with Selenium IDE
Bring Accessibility into the Development Lifecycle with CI Testing
Testing Alfresco extensions (no, it’s not about jUnit)
Selenium HP Web Test Tool Training
Software Testing.
Google Web Toolkit Tutorial
Automated UI Testing with Seleno.
Introduction of Selenium Webdriver Using Java
Automating GUI testing with Selenium WebDriver, Java and Eclipse
Software Quality Assurance
MONASH ENGINEERING MoodleBOT
Haden Jackson-Robbins
Selenium HP Web Test Tool Training
Modern web applications
Sharing the good, the bad, the ugly & What can we do about it?
Improving the structure of existing code
Web UI testing automation and Selenium
Modern web applications
MIS JavaScript and API Workshop (Part 2)
CSCE 747 Software Testing and Quality Assurance
DevOps Meetup | Test Automation | 3/19/2012
PART 2 LESSON XX Creating Test Cases
An introduction to jQuery
An introduction to jQuery
CSCE 747 Software Testing and Quality Assurance
An introduction to jQuery
Test Cases, Test Suites and Test Case management systems
Presentation transcript:

Testing Your Alfresco Add-ons Michael Suzuki Software Engineer

Testing Your Alfresco Add-ons Introduction Automation Tools Best Practice Setting Up With Maven Demo Were going to cover testing: The tools that are available The patterns And how to do it.

Michael Suzuki @suzukimichael github.com/michaelsuzukisagi

Testing your add-on’s gives you the confidence that they are behaving correctly. What is this talk about.

Why Testing Makes Sense It builds Confidence that the systems is behaving as it should. Validates no regression bugs have been introduced Helps find problems early Shorter feedback loops when refactoring We don’t wait till the qa phase to find problems.

Test Types Unit Tests Integration Tests Functional Tests Unit tests,tests the unit. Integration test ensures services are talking to each other. Functional that the software meets the requirements.

The Right Balance

Value Of Automation Detecting difference Pins the functionality Avoid wasted effort Less duplication

Testing Your Alfresco Add-ons Automation Tools

WebDriver An open source browser automation API. Supports different OS, languages and browsers.

WebDriver Code { //Start fire fox WebDriver driver = new FireFoxDriver(); //Navigate to share driver.navigate(http://localhost:8080/share); }

Locator Strategies Id Name Tag name Class name CSS selector Xpath Link Text Partial Link Text Talk about locators: By id,css,xpath, tag name.

Locator Strategies In Action { //By Id WebElement username = driver.findElement(By.id(“iusername”)); //By Name WebElement password = driver.findElement(By.name(“password”)); //By Tag Name WebElement btn= driver.findElement(By.tagName(“button”)); //By CSS selector username = driver.findElement(By.cssSelector(“input#iusername”)); //By class name WebElement btn =driver.findElement(By.className(“button”)); //By xpath btn = driver.findElement(By.cssSelector(“//button)); }

Interacting With Elements { //Find Element By Id WebElement element = driver.findElement(By.id(“foo”)); //check if visible element.isDisplayed(); //type in admin element.sendKeys(“admin”); //clear input field element.clear(); //click action element.click(); //get text element.getText(); }

Testing Your Alfresco Add-ons Best Practice

Always Use Page Object Pattern Render Pattern Why cause it makes hard to maintain test code

Page Object “A page object wraps an HTML page, or fragment, with an application-specific API, allowing you to manipulate page elements without digging around in the HTML” Martin Fowler

Login Page Object public class LoginPage { private static By USERNAME_INPUT = By.id(“username"); private static By PASSWORD_INPUT = By.id(“password"); private static By SUBMIT_BUTTON = By.id(“submit"); public LoginPage(WebDriver driver) {} public void login(String username, String password) // Find By Id WebElement username = driver.findElement(USERNAME_INPUT); username.sendKeys(username); WebElement password = driver.findElement(PASSWORD_INPUT); password.sendKeys(password); driver.findElement(SUBMIT_BUTTON).click(); }

Why You Should Use Page Objects Encourages re-use of the code Makes tests more readable Encapsulates mechanical details of the page Easier to maintain Less duplication

Render Pattern The logic which determines if a page has rendered, by checking that all the required web elements of the page, are visible before it can be used.

Render Method In Action public LoginPage render(RenderTime timer) { while (true) timer.start(); try if(driver.find(USERNAME_INPUT).isDisplayed() && driver.find(PASSWORD_INPUT).isDisplayed() && driver.find(SUBMIT_BUTTON).isDisplayed() break; } catch (NoSuchElementException nse){} finally timer.end(); return this; Addresses intermitted test failures and Thread Sleep. Loops to find input fields and submit button, if not found the timer eventually throws a PageRenderTimeException

Share PO Project Aims to mimic user interaction on Alfresco Share. A library that is simple, reliable and reusable. The project started in 2012 and is now part of Alfresco core. Currently used by Functional test (aka QA share) and Benchmark

WebDrone Project A Selenium WebDriver wrapper with added functionality. Provides additional tools: Selenium grid Image recognition Language support Currently used by Functional test (aka QA share) and Benchmark

Things To Avoid WebDriver code in test code Assertions in page objects Thread sleep Why cause it makes hard to maintain test code

Testing Your Alfresco Add-ons Demo

Build Add-ons with Maven Setup Spring Loaded export SPRING_LOADER=/usr/local/lib/spring-loaded/springloaded-1.2.0.RELEASE.jar Setup Maven options with Spring Loaded export MAVEN_OPTS="-XX:MaxPermSize=512m -Xmx1024m -javaagent:$SPRING_LOADER -noverify" Run AMP with Maven Create a directory mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public/archetype-catalog.xml -Dfilter=org.alfresco.maven.archetype: Type 1 to build amp Type option 5 to get latest archtype Type a groupid org.alfresco.summit Type aritfact id, the project name: demo If out of memory type MAVEN_OPTS='-Xms256m -XX:MaxPermSize=1024m -Xmx1024m’ Run alfresco mvn integration-test -Pamp-to-war To run share, cd into directory and type mvn integration-test -Pamp-to-war -Dmaven.tomcat.port=8081 mvn integration-test -Pamp-to-war

Thank you

Additional Info Share Page Object WebDrone Demo Selenium WebDriver https://github.com/Alfresco/community-edition/tree/master/projects/share-po WebDrone https://svn.alfresco.com/repos/alfresco-enterprise/benchmark/webdrone Demo https://github.com/michaelsuzukisagi/summit2014.git Selenium WebDriver http://docs.seleniumhq.org/docs/03_webdriver.jsp https://code.google.com/p/selenium/wiki/PageObjects Alfresco Maven http://ecmarchitect.com/alfresco-developer-series-tutorials/maven-sdk/tutorial/tutorial.html http://www.youtube.com/watch?v=Tu641nRGbtQ Spring Loaded https://github.com/spring-projects/spring-loaded