AD208 - End to End Quality Processes for Top Notch XPages Apps

download AD208 - End to End Quality Processes for Top Notch XPages Apps

If you can't read please download the document

Transcript of AD208 - End to End Quality Processes for Top Notch XPages Apps

AD208: End-to-End Quality Processes for Top Notch XPages Apps

Martin Donnelly, IBM IrelandBrian Gleeson, IBM IrelandPadraic Edwards, IBM Ireland

IBMs statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBMs sole discretion. Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or functionality. Information about potential future products may not be incorporated into any contract. The development, release, and timing of any future features or functionality described for our products remains at our sole discretion

Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the users job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.

Please Note

Agenda

Speaker introductions & Goals

Main TopicsAutomated GUI Testing

JUnit API Testing

Accessibility Compliance

Wrap UpXPages Quality App Checklist

Conclusions

Q & A

Speaker Introductions

Martin Donnelly - Software Architect : IBM IrelandIBM Domino XPages

IBM Domino Designer

JavaServer Faces (JSF) Tooling IBM Rational Application Developer

Java Visual Editor extensions for IBM Rational Application Developer

Software Developer: Iris Associates / Lotus DevelopmentIBM Lotus Domino Designer V4.6 to V6.01

IBM Lotus 1-2-3 for Unix

LotusScript, etc.

AuthorMastering XPages

XPages Portable Command Guide

Speaker Introductions

Brian Gleeson Software Engineer IBM IrelandJoined IBM in 2009XPages Runtime Development

XPages Test Automation

ContributionsXPages Extension Library

XPages Templates

OpenNTF contributor

Padraic Edwards Software Engineer IBM IrelandJoined IBM in 2004XPages Runtime Development

ContributionsXPages Core Runtime

XPages Extension Library

OpenNTF contributor

Social Business Toolkit SDK

Session Goals
Introducing Frank Adams

Frank Adams XPages Project Manager

Session Goals

Development

Testing

Profiling & Tuning

Deployment

Application Development Lifecycle

Examine technologies & best practices in the Testing & Tuning phases

Highlight best practices in Development stage

ppt template divider slide 1c-01.png

Automated GUI Testing


Does your control/application render correctly on all browsers & platforms?

Does the functionality match what you expect on all browsers & platforms?

Do you have a mobile interface that works across devices?

Testing across multiple browsers, phones & tablets

Source: http://gs.statcounter.com

Selenium is a browser automation framework

Selenium IDE record & playback, auto-generates code

Selenium supports tests written in Python, Ruby, Perl, PHP and Java.

Latest version: Selenium v2.39

WebDriver API

ChromeDriver

IEDriver

FirefoxDriver

AndroidDriver

iPhoneDriver (+ iWebDriver app)

...and more

Source: http://gs.statcounter.com

Selenium

Source: http://seleniumhq.org


Testing framework based on JUnit

Run test suite & report the results

Provides results in HTML and XML format

Customisable format & layout

Take screenshots upon failures

TestNG Annotations, e.g:

@Test

@BeforeClass

@AfterMethod

Plugin for Eclipse/IBM Domino Designer

TestNG

Combine Selenium & TestNG

Install TestNG plugin

2. Add Selenium jars to project build path

3. Create a Selenium test Java class

4. Create a WebDriver instance

5. Create a Selenium test method

6. Add TestNG annotation (@Test)

Combine Selenium & TestNG (ctd.)

11. Reference the Java class

10. Create TestNG test suite XML file

12. Include @Test methods

13. Run the TestNG suite

7. Find WebElements using findElement() & Selenium By class

8. Call methods on WebElements

9. Perform assertions on expected outcomes

XPathBy.xpath("//a[@id='view:_id1:link1']");

cssSelectorBy.cssSelector("a[id='view:_id1:link1']");

linkTextBy.linkText("click me");

othersBy.id(...), By.className(...), By.tagName(...)


demo-large

Pitfalls and Best Practices

Don't use auto-generated idsBy.cssSelector("button[id='view:_id1:_id12:_id234_id56']");

WebDriver cannot interact with browser dialogsSelenium workarounds available.

Other options - AutoIT and java.awt.Robot

Be careful with WebDriver & iframeswebDriver.switchTo().frame(String frameId);

Communication between Dev & Test

Developers can write automation!

Set ImplicitWait timeout valuewebDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

User-Agent manipulation to emulate mobile device testing

Selenium Grid

Allows for distributed parallel test execution

Central hub controls a number of nodes

Hub activates tests across available nodes

Nodes report results back to the hub

Parallel automated testing across browsers & platforms

Better & faster testing coverage

Source: http://seleniumhq.org

Jenkins

Java-based Open Source Continuous Integration Tool

Build software projects

Test software projectsAutomate the automation!

Monitor executions of externally-run jobs

Provides web interface for configuration and monitoring

Extensible write your own Jenkins plugins

Source: http://jenkins-ci.org

ppt template divider slide 1c-01.png

JUnit API Testing

Building in Testability

Build a unit test suite to verify that a new or existing library of controls is fit for purpose

JUnit Overview

XPages JUnit Test Framework Overview

Creating an Example Test Suite

Demo

Pitfalls and Best Practices


JUnit is a unit testing framework for the Java programming language

Unit Tests ensure Java code is working as intendedCreate an Object

Invoke a method

Check the result

Provides a mechanism to make assertions about the state of your objectsAssertTrue fails if condition is false; passes otherwise

AssertEquals fails if expected and actual objects are not equal

And others...

JUnit plugin is part of IBM Domino Designer

Build a suite of testcases to verify functionality doesn't change after code changes

Fixing defects can be expensive save time & money by catching them with JUnit tests

JUnit Overview

XPages JUnit Framework

Provides predictable test cases that the XPages team have created to test the core and extension library Java controls

Suite of test cases that can be applied to your library of controls

Verify xsp-config files can be parsed

Verify set methods correspond to property names

Verify controls can be serialized

And others...

Utility to generate .java files from .xsp files

Utilities for creating the JSF control tree and rendering HTML to the .xsp file

Extendable for your own specific test needs

Ideally requires some knowledge of the xsp-config file format

http://goo.gl/aX5x98

Testing a new Java control with XPages JUnit Framework

Create new test plugin that depends on JUnit and XPages JUnit Framework plugins as well as core runtime plugins

Create a TestSuite class and specify test cases to run

Begin with the BaseGeneratePagesTest generating the .java files from .xsp files

Create a config.properties file in com.ibm.xsp.test.framework package

target.library

NamingConvention.package.prefix

extra.library.depends.designtime.nonapplication

Create a xsp.properties in WEB-INF folder

Create JUnit tests that extend the base tests

Wiki Article - http://goo.gl/DIYsqZ

Example: Extended JUnit Tests

BaseLabelsLocalizedTest is for testing a predefined list of properties which should always be localizable when defined in a control, namely:

label

title

alt

and others..

Add new mainTitle property that we want to be localized

Add new title property that we don't want to be localized in this test case

Extend BaseLabelsLocalizedTest as new ExampleLabelsLocalizableTest

Add new localizable property (mainTitle) to list of properties to be tested as localizable

Change xsp-config to omit title property as localizable


demo-large

Custom XPages Library

com.example.xspExtended JUnit test suite for your library

com.example.junit.testsCustom selenium test-suite for your library

SeleniumXPagesTestSuiteXPages JUnit test Framework

com.ibm.xsp.test.framework

Elements in my Java navigator in IBM Domino Designer

Pitfalls & Best Practices

Start to run JUnit tests from the beginning of development cycle

even if you haven't written any yet!

Don't edit the test framework project itself. Create a subclass and update the behavior there

Always begin by generating .java files if testing .xsp files

Do not check in the contents of the gen/ folder to source control

If a test fails, read the test description and read the failure messageDebug into source code itself (if needs be)

Learn from existing ExtLib tests in .control package available on OpenNTF

//test that generates .java files from .xsp files// at the start, as other tests depend on it to pass.// - BaseGeneratePagesTestsuite.addTestSuite(BaseGeneratePagesTest.class);

XPages Accessibility

XPages Accessibility
Why should we worry about accessibility?

Millions of people worldwide live & work with a disability

IBM requirement

Extend market reach

Requirement for Government services

Promotes good Design Practices

Promotes better usability

Your shiny new app...

As a simple example, imagine you have created your XPages app, fully featured, looking great and ready to be releaseds out into the world. Now turn off your monitor. Would your app still be usable now? (next slide)

Consider that for many users with a visual disability they cannot see any of the visual aspects of your application. Instead they rely on screen readers to read out the content to them, and rely on only the keyboard for navigation, so no mouse interactions. To be accessible, your app must support screen readers and keyboard navigation.

...now turn off your monitor!

Lower images sourced from: www.colourblindawareness.org

Colour blindness example

XPages Accessibility
A brief overview

XPages must be compliant to WCAG 2.0 level A and level AA, and US Section 508 standards

XPages is the recommended accessible solution for IBM Domino Web Apps

There is no single solution but rather choose an accessible path

Make use of the tools, techniques and documentation availableA good starting point - http://www.w3.org/WAI/

XPage Web AppsIBM Web Accessibility Checklisthttp://goo.gl/YLPqm0

XPages in the Client (XPinC) AppsIBM Software Accessibility Checklisthttp://goo.gl/xDCrQF

XPages Accessibility
Supported Environments

In v9.0.1, the accessible path supported by XPages is:Microsoft Windows 7

Mozilla Firefox 25

JAWS 14

English was chosen test language

Theme: OneUI v2.1 Blue

XPages Accessibility

WAI-ARIA standardAccessible Rich Internet Applications

http://www.w3.org/WAI/intro/aria.php

Supplements HTML content

Increases accessibility of webpages

Some XPages controls are accessible out-of-the-box

Accessibility specific properties in IBM Domino Designer e.g. 'role', 'title', 'description' properties

'attrs' property for adding additional aria attributes

XPages Accessibility

XPages Accessibility
IBM Accessibility Verification Testing (AVT)

AVT1 - Automated Test ToolsFirefox plugin: Rational Policy Tester (RPT) including Dynamic Assessment Tool

AVT2 - Manual TestsKeyboard Navigation

Focus & Sequence

Visual formatting

Colour contrast

High contrast

Large font

Alternative content for audio/video

Error handling

AVT3 - JAWSScreen Reader tool

XPages Accessibility
Guidelines & Best practices

Accessibility should begin at the 'Design' phaseDesign your apps with accessibility in mind

Keep things simple & avoid over-complicating design

Use Accessible Controls where possibleSee Control Reference sections of the Help User Guide to help choose controls

In 9.0.1, new accessibility properties have been added to some controls

Error PagesProvide customized accessible XPage error pages

XPages Accessibility
Guidelines & Best practices (cont.)

Using Events in your applicationAny mouse event must have a matching keyboard event

Using Access Keys in your applicationSet accesskeys in IBM Domino Designer

Make the bindings unique and intuitive

Using Partial UpdateEnsure that the updated area/control is further down the page

Login PagesEnable SSO on the Domino Server for accessible user authentication

ppt template divider slide 1c-01.png

Wrap Up

XPages Quality App Checklist

API + GUI TestingSelenium and JUnit

XPages Toolbox Profile your use cases

Provides detailed analysis per request on CPU, Memory, Time costs

Adhere to the 10 golden rules of XPages Performancesee Mastering XPages book for details

Preload commonly used apps where possible

Base your installation on IBM XPages 9.0.1 !

Conclusions

Frank

Automated GUI Tests

JUnit APITest Suite

FullyAccessible

XPagesChecklist

Contact Information:[email protected]@[email protected]

Questions & Answers

Technical Education

IBM Press Books and eBooksThree major publications over the past two years

All available for evaluation in the bookstore in the Solutions Expo

Technical Education

Coming very soon

Mastering XPages 2nd EditionBased on Notes/Domino 9.0.1

4 new chaptersPerformance/Scalability

Mobile

Debugging

Application Layout

Comprehensive updates to all pre-existing content

Hardcover~500 pages of new content

~1200 pages total

More Information General

For all information on XPages head to XPages.info http://xpages.info/XPagesHome.nsf/Home.xsp

The Notes Domino Application Development Wikihttp://www-10.lotus.com/ldd/ddwiki.nsf

Free XPages snippets from the communityhttp://openntf.org/XSnippets.nsf/home.xsp

And don't forget the XPages books from IBM Presshttp://www.ibmpressbooks.com/search/index.asp?query=xpages

Learning RoadmapsNew Developers

Experienced Developers

More information Automation, JUnit & Accessibility links

Selenium - http://code.google.com/p/selenium & http://seleniumhq.org/

TestNG - http://www.testng.org

Jenkins - http://www.jenkins-ci.org/

XPath - http://www.w3.org/TR/xpath/ & http://www.w3schools.com/xpath/

CssSelector - http://www.w3.org/TR/CSS2/selector.html

Firebug - https://www.getfirebug.com/

Chrome User-Agent Switcher on chrome webstore

Web Accessibility Initiative - http://www.w3.org/WAI/

IBM Accessibility Checklists - http://w3-03.ibm.com/able/devtest/web.html & http://w3-03.ibm.com/able/devtest/software.html

JAWS - http://www.freedomscientific.com/products/fs/jaws-product-page.asp

Colour blindness - http://www.colourblindness.org

Testing XPages with the JUnit Framework Wiki Article - goo.gl/e8zQp2

More Information Summary

XPages.info One Stop Shopping for XPages
http://xpages.info

XPages Forum Got Questions, Need Answers?
http://xpages.info/forum

OpenNTF Open Source Community
http://www.openntf.org

Domino Application Development Wiki
http://www.lotus.com/ldd/ddwiki.nsf

XPages Blog
http://xpagesblog.com

IBM Educational Offerings
http://www.ibm.com/software/lotus/training/n8deducationofferings.html

SocialBiz User Group socialbizug.org

Join the epicenter of Notes and Collaboration user groups

Follow us on Twitter

@IBMConnect and @IBMSocialBiz

LinkedIn http://bit.ly/SBComm

Participate in the IBM Social Business group on LinkedIn:

Facebook https://www.facebook.com/IBMSocialBiz

Like IBM Social Business on Facebook

Social Business Insights blog ibm.com/blogs/socialbusiness

Read and engage with our bloggers

Engage Online

ppt template thank you 1-01.pngAccess Connect Online to complete your session surveys using any:

Web or mobile browser

Connect Online kiosk on site

Session ID: AD-208

Session Title: End-to-End Quality Processes for Top Notch XPages Apps

Merci

Grazie

Gracias

Obrigado

Danke

Japanese

Buochas

Copyright IBM Corporation 2014. All rights reserved.

U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

IBM, the IBM logo, ibm.com, Domino and XPages are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol ( or ), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at Copyright and trademark information at www.ibm.com/legal/copytrade.shtml

Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc.Microsoft and Windows are trademarks of Microsoft Corporation.Chrome is a trademark of Google Corporation.Firefox is a trademark of Mozilla Corporation.JAWS is a trademark of Freedom Scientific.

Availability. References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They are provided for informational purposes only, and are neither intended to, nor shall have the effect of being, legal or other guidance or advice to any participant. While efforts were made to verify the completeness and accuracy of the information contained in this presentation, it is provided AS-IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this presentation or any other materials. Nothing contained in this presentation is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and performance characteristics may vary by customer. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.

Acknowledgements and Disclaimers

ppt template divider slide 1c-01.png

Top 10 Golden Rules

Top 10 Golden Rules of XPages Performance

Use Partial Refresh whenever possible

Use Get instead of Post requests

Use readonly property on container type controls

Apply Partial Execution Mode to limit server side execution of an XPage

Use the dataCache property on Domino views to save on memory

Top 10 Golden Rules of XPages Performance(contd)

6. Use viewScope instead of sessionScope and applicationScope

7. Avoid using rendered property to show/hide controls - use loaded property!

8. Avoid costly Notes/Domino API calls like getDocument*() in repeats and/or controls

9. Favour Disk Persistence

10. Always Enable Resource Aggregation

ppt template divider slide 1c-01.png

Tuning, Profiling & Debugging

XPages Toolbox Profiling ApplicationRuns on the Domino server or the Notes client

Provides detailed analysis per request on CPU, Memory, Time costs

IBM Domino Designer Code DebuggersServerSide JavaScript Debugger

Java Debugger

Client/Server LoggingJVM Logging (can be controlled using the XPages Toolbox)

Request Introspection, print, _dump TechniquesIntrospection techniques can be utilized using lifecycle PhaseListeners

print, _dump Techniques can be incorporated into application code

Tuning, Profiling & Debugging

XPages Toolbox Profiling ApplicationRuns on the Domino server or the Notes client

An NSF needs to be installed on the Domino server/Notes client

A profiler jar file should be added to the JVM launch options

JVM Security policy updates

Profiles and MeasuresCPU performance, Memory allocation, Threads, Sessions, Backend Activity

Profiling API can also be added into ServerSide JavaScript and/or Custom Java

Available from OpenNTF.orgFree open source project

Search for XPages Toolbox (Most recent version is 1.2)

XPages Toolbox

CPU Profiler

Memory Profiler

XPages Toolbox

XPages Toolbox

Generate a heap dump of the JVM running in the HTTP taskA button in the XPages profiler generates the heap dump

A new command from the Domino consoletell http xsp heapdump (triggers com.ibm.jvm.Dump.HeapDump())

tell http xsp javadump (triggers com.ibm.jvm.Dump.JavaDump())

Analyze the heap dump using the Eclipse memory analyzer

http://www.eclipse.org/mat/

XPages Toolbox

ppt template divider slide 1c-01.png

Automation DemoBackup Screenshots

Sample Xpage App

Sample Xpage App (cont.)

Selenium Test

Connect2014Example.java Example XPages Selenium Test


SeleniumXPagesTestSuite Project

Example Selenium Project open in the Java perspective


Selenium + TestNG Project

SeleniumXPagesTestSuite with added TestNG example suite


SeleniumXPagesTestSuite Project Build Path

Shows the build path configuration pointing to the Selenium Libraries


TestNG Test Output

Passed TestNG Output:

Failed TestNG Output:

ppt template divider slide 1c-01.png

JUnit Demo BackupScreenshots


XPages Example JUnit Suite

ExampleTestSuite to run the base set of tests from the XPages JUnit test framework

Base XPages JUnit Framework testExtended JUnit test


ExampleLabelsLocalizableTest.java

Extended JUnit Test to add mainTitle property as localizable


Example XPages JUnit Project Pieces

Config.properties

Properties file needed in your test plugin to configure XPages JUnit framework


Localizable and not-localizable tags for properties

Properties file needed in your test plugin to configure XPagesJUnit framework


Passing JUnit ExampleTestSuite

Click to edit the outline text format

2013 IBM Corporation

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline Level

2013 IBM Corporation

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline Level

Sixth Outline Level

Seventh Outline Level

Eighth Outline Level

Ninth Outline Level

2012 IBM Corporation

ppt template title slide 2-01.png 2014 IBM Corporation

IBM SP 8-bar pos_horizontal-01.png

ppt template content slide 2-01.png

ppt template title slide 2-01.png 2014 IBM Corporation

IBM SP 8-bar pos_horizontal-01.png

ppt template content slide 2-01.png

ppt template content slide 2-01.png

ppt template content slide 2-01.png