Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.

Slides:



Advertisements
Similar presentations
Acceptance Testing vs. Unit Testing: A Developers Perspective Owen Rogers Rob Styles
Advertisements

Testing Web Applications & Services Testing Web Applications & Web Services.
Test Automation: Coded UI Test
Languages for Dynamic Web Documents
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.
UNIT-V The MVC architecture and Struts Framework.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
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.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.
Val Kravets, Luis Sanchez, Allen Chung, Phillip Anderson, Leyla Norooz, Brian Ramnarian, Todd Watson.
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
Objectives  Testing Concepts for WebApps  Testing Process  Content Testing  User Interface Testing  Component-level testing  Navigation Testing.
Struts2 Plugin Development - Extending Struts2 Justin Yip.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Exploring an Open Source Automation Framework Implementation.
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.
Web Development 101 Presented by John Valance
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
Selenium January Selenium course content  Introduction (Session-1)Session-  Automation  What is automation testing  When to go for automation.
Lec 19 Web Driver 1 CSCE 747 Fall 2013 CSCE 747 Software Testing and Quality Assurance Lecture 19 Selenium Web Driver 11/4/
Basic JSP Celsina Bignoli Problems with Servlets Servlets contain –request processing, –business logic –response generation all lumped.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
G.Govi CERN/IT-DB 1 September 26, 2003 POOL Integration, Testing and Release Procedure Integration  Packages structure  External dependencies  Configuration.
Martin Kruliš by Martin Kruliš (v1.1)1.
ScriptOnce™ & Best Practices. Agenda 2 Automation that works ScriptOnce –Minimal maintenance –Easy to add devices Robustness –Reliable Scripts - Minimize.
Test Automation Using Selenium Presented by: Shambo Ghosh Ankit Sachan Samapti Sinhamahapatra Akshay Kotawala.
IT323 - Software Engineering 2 1 Tutorial 4.  List the main benefits of software reuse 2.
------TAO, MARKUS Project IT. JavaDoc ‣ JavaDoc is a standard method of commenting source code (interfaces, classes, methods, instances variables). ‣
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.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Customizing Share Document Previews Will Abson Senior Integrations Engineer and Share Extras Project Lead
#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.
#SummitNow The Share Widget Library 13 th November 2013 Dave Draper
 Project Team: Suzana Vaserman David Fleish Moran Zafir Tzvika Stein  Academic adviser: Dr. Mayer Goldberg  Technical adviser: Mr. Guy Wiener.
#SummitNow Lessons Learnt From Share Extras Alfresco Summit 2013 Will Abson
Load Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
Web API - Introduction AJAX, Spring Data REST SoftUni Team Web API
The Share Widget Library
Selenium HP Web Test Tool Training
The Zen of UI Test Automation
How to Test a Complex ERP Application using a Data-Driven Framework
Bring Accessibility into the Development Lifecycle with CI Testing
Testing Alfresco extensions (no, it’s not about jUnit)
Understanding SOAP and REST calls The types of web service requests
Automated UI Testing with Seleno.
Introduction of Selenium Webdriver Using Java
Automating GUI testing with Selenium WebDriver, Java and Eclipse
Testing Your Alfresco Add-ons
Software Quality Assurance
Haden Jackson-Robbins
Modern web applications
Using REST and UI Testing to Test an Ajax Web Application
Web UI testing automation and Selenium
DevOps Meetup | Test Automation | 3/19/2012
Designing For Testability
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

Michael Suzuki github.com/michaelsuzukisagi github.com/wabson

Why Testing Makes Sense It builds Confidence that the systems is behaving as it should. Validates no regression bugs have been introduced Pins the functionality Helps find problems early Detecting difference

Test Types Unit Tests Integration Tests Functional Tests

The Right Balance

Unit Testing in the UI This has been hard until now! Aikau provides a framework for developing AMD modules (widgets) on top of Share Testing is built-in using Grunt, Intern.io, Node, NPM

Unit Testing – How it Works Intern.io provides testing framework Static JSON model defines the widgets to be tested inside a page Bootstrap webscript supplied by Share to take the test data in the body of a POST request

Decoupling Widgets Tests use pub/sub framework to drive widgets and capture behaviour Special logging widget Alfresco/testing/SubscriptionLog to ensure the correct data Tests can run separately from the repository Widgets should use ‘services’ which provide them with data, and which can be substituted with mock data.

Code Coverage code-coverage NPM package allows us to measure coverage Grunt tasks to instrument the Aikau code, run test suites and gather the results

Running Unit Tests Different options for running the tests Local Selenium (typically used to write tests) Vagrant VM for local continuous background testing Internal or external grids (e.g. SauceLabs)

More Information Declarative Configuration of Share – Dave Draper / David Webster Dynamic UI Generation with Share and Aikau – Kevin Dorr Unit Testing Aikau /02/26/unit-testing-aikau/ 14/02/26/unit-testing-aikau/

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( }

Locator Strategies Id Name Tag name Class name CSS selector Xpath Link Text Partial Link Text

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

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

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; }

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.

WebDrone Project A Selenium WebDriver wrapper with added functionality. Provides additional tools: Selenium grid Image recognition Language support

Things To Avoid WebDriver code in test code Assertions in page objects Thread sleep

Testing Your Alfresco Add-ons Demo

Build Add-ons with Maven mvn install -Pamp-to-war mvn archetype:generate - DarchetypeCatalog= oups/public/archetype-catalog.xml - Dfilter=org.alfresco.maven.archetype: export MAVEN_OPTS="-XX:MaxPermSize=512m -Xmx1024m” Setup Maven options Create project from archetype Run AMP with Maven Run test mvn install –Pfunctional

Thank you

Additional Info Share Page Object WebDrone Demo Selenium WebDriver Alfresco Maven Spring Loaded