SlideShare a Scribd company logo
1 of 44
Tips for Developing and Testing
IBM Host Access Transformation
Services Applications
Kenny Smith, Strongback Consulting
About Strongback Consulting
• IBM Advanced Business Partner
– Rational, WebSphere, ICS SVP certified
– Strongly focused on DevOps, Enterprise Modernization, and application infrastructure
– Key Industries Served: Finance, Insurance, Travel, Logistics, Healthcare, Manufacturing, Government
– Rational Design Partner for HATS and other Rational enterprise modernization technologies
Discover us at:
http://www.strongback.us
Subscribe to us at
http://blog.strongbackconsulting.com
Socialize with us on Facebook & LinkedIn
http://www.facebook.com/StrongbackConsulting
http://www.linkedin.com/company/290754
Developing HATS apps
Recipes for success
2
Overview of Development Cycle
Uniquely
tailor the user
experience
Custom
widgets,
components
i18n
Consume
web services
Make DB
calls
3 months +
Add Complex
Customizations
Customize
some
screens
Implement
macros
Provide Web
Services
1-2 month
Moderate
Customization
Apply your
own skin
Modify
default
rendering
rules
< 1 week
Custom
Template
Out of the
box rendering
Minimal
changes
< 4 hours
Default
3
Basic deployment
• Keep It Simple
• Basic out of the box implementation
• Time: an afternoon
4
Modest customization
• “Skin” it to make it look more like your
own company site
• Global Rules and Text Replacement
– Calendar pickers
– Radio buttons for data entry
• Customize only the most heavily used
screens
– Tweak subfiles and tables
– Add navigational links
5
Moderate customization
• Macros
• Producing Web services
• Consuming web services
• More screen customizations
• Some custom Javascript functions
• Integration with Portal
• Mobile Application
6
Heavy customization
• Gung ho!
• Create Custom Widgets and
Components (i18n)
• Connect to databases
• Deep screen customizations
• Integration with ERP or CRM
• Dig under the hood and control at a
Java API level
– Custom screen recognition
– Custom macro actions
– Custom business logic
7
General Guidelines For Renderings
• Do the simplest thing that can possibly work
• Customize by exception
– Let default rendering do the work
– Focus on getting Default Rendering rules working first
• Don’t edit the HATS Javascript files
– Put your customizations in separate .JS files
• Edit or copy from the OOTB the CSS files
– Use the OOTB class names
• Accept that sometimes a quick fix in RPG/COBOL is easier than toiling
over a crappy green screen issue
8
General Rules for Web Services and I.O.’s
• Develop macro thoroughly
• Build "Happy path" first
• Develop and account for "sad paths" (could be many of them)
• Don't generate web service stubs until you've got the macro solid!
• You can edit the I.O. template file if it does not generate what you need
9
If you must do mockups
• When doing big customizations….
• Write your mockups in plain HTML
• Don’t do Photoshop or image based mockups
• HTML can be directly used as stubs for the template & screen
customizations
10
Tips for using SCM with HATS
How to avoid throwing coffee at your monitor
11
General Tips
• Team development in a single HATS app can be a challenge
• Project settings document will require careful merging
– WEB-INF/profiles/application.hap
• Some files will drive you nuts – they change every save … and don’t
need to be versioned
• Use xmlUnit to unit test the application.hap – require a unit test run
before code delivery
**This is a setting that can be enforced in Team Concert
*** slides coming up on these details later
Avoid aggravation: Ignore these files
• All log files HATS_EAR/logs
• Web Content/WEB-INF/profiles/resourceUpdate.sts
Use good naming conventions
• Prefix all artifacts with a screen identifier
• Package naming
– [com | gov | net].<mycompany>.<appname>.<type>
• Example:
– com.strongback.crm.hats.domain
– com.strongback.crm.hats.io
– com.strongback.crm.hats.businessLogic
– com.strongback.crm.hats.widgets
– test.strongback.crm.hats.businessLogic
14
Testing
Unit Testing, Functional Testing, and Performance Testing
15
Types of Testing
• Policy (Accessibility)
• Security
• Performance
– Load, stress
– Can be automated
• Functional
– a.k.a. “Black Box” or User Acceptance Test
• Unit
– Written by developer, run by developer
– Junit, xmlUnit
– Always automated, and part of continuous build cycle
16
Performance Testing
• Tests should look at JVM GC over time
– use WAS’ performance monitor tools to collect
– Look at heap utilization, garbage collection stats
• Test script should be a subset of real application usage, and timing
• DON’T expect HATS interaction time to be as fast as an emulator!!
– Emulator: Direct connection between user and host
– HATS: 1 connection from host to WAS, 1 from WAS to user
17
What adversely affects performance?
• Excessive screen customizations (>100)
• Poorly written custom Java code
• Compression filter *
• Database calls
• Insufficient Memory in WAS
• Poorly resourced LPAR
• The perceived time between screens is the key indicator to watch for!
18
Performance Testing Gotcha
• Compression Filter
– Designed to compress HTTP response
• Will cause JVM crashes if not
configured
– Compression is one of the most expensive
tasks a CPU can do
– Default size is 0KB
• Either disable, or set parameter > 1KB
19
Functional Testing
• Tools: RFT, Selenium
• 3 priorities
– Test screen customizations first
– Test screens with high usage patterns next
– Test a subset of default rendered screens
• Think subfiles, tables, calendar pickers, etc.
• Reuse test data!
– Same RFT data can be used for pure terminal emulator tests
– IBM Test Data Manager
20
Record Terminal First
• RFT can test 3270/5250
• use the same data to test
HATS
21
Unit Testing – what is it?
• Developer written to test other code
• Can be automated
• Results in a pass or fail
• Example:
– Class to test the XML of the Project Settings
document
– Class to test a custom widget, or custom
component
22
Unit Testing: Why its difficult
• Custom Java classes that use the HATS API
– Business Logic
– Screen Recognition
– Integration Objects
• Usual methods invoke the HATS Runtime Engine
– i.e. requires a live connection
23
public static void execute( IBusinessLogicInformation blInfo) {….}
This gets
populated by the
runtime
environment
Introducing Mocking and Stubbing
• http://mockito.org/
• Mocking framework that creates a mock of a system
• i.e. it mocks the behavior of the host
24
How Mocking Works:
25
host
screen
i/z Host
Mock this
HATS
Engine
Normal Operation
26
Class under
Test
Dependent Class
(IBusinessLogicInformation )
Stubbing
• Stubs return fixed results on each call
• In this case, its fixed to return the desired
screen when its getHostScreen() method
is called
27
HostScreen hsr = readHostScreenFromFile(“myscreen.hsr”);
Mockito.when(blInfo.getHostScreen()).thenReturn(hsr);
Screen Captures: XML under the covers
28
The HostScreen Object
• Two Ways to Instantiate:
• HostScreen hostScreen = blInfo.getHostScreen();
• HostScreen hostscreen = new HostScreen(screencapture);
29
This constructor
requires an XML
file!
Create a convenience method to read the file
Read the screen capture in as an XML Document, then pass to the HostScreen constructor
protected HostScreen readHostScreenFromFile(String screenFileName)
throws UnsupportedEncodingException, ParserConfigurationException, IOException
, SAXException {
URL url=this.getClass().getResource(screenFileName);
String file= URLDecoder.decode(url.getFile(), "UTF-8");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document screencapture = builder.parse(file);
HostScreen hostscreen = new HostScreen(screencapture);
return hostscreen;
}
30
Now, mock and stub
@Mock
protected IBusinessLogicInformation blInfo;
@Test
public void testOperatorNameSetsCorrectValue() throws SAXException, IOException,
ParserConfigurationException {
OperatorName opname = new OperatorName();
HostScreen hostscreen = readHostScreenFromFile(SCREEN_MAIN_MENU);
Mockito.when(blInfo.getHostScreen()).thenReturn(hostscreen);
Hashtable hastableGVs = new Hashtable(1);
Mockito.when(blInfo.getGlobalVariables()).thenReturn(hastableGVs);
opname.execute(blInfo);
com.ibm.hats.common.GlobalVariable operator = (com.ibm.hats.common.GlobalVariable)
hastableGVs.get("operatorId");
assertEquals("KENNY SMITH (ASATKSM)", operator.getString().trim());
}
31
Mock the
Business
Logic Object
This B.L. object gets the
operator name from
specific coordinates and
sets a global variable
Stub its
getHostScreen()
method
Advantages of Mocking
• Repeatable
– Do not have to reset data after a test
• Does not require connection to the system
• Allows integration with a build system
– i.e. Jazz Build Engine, Hudson, Jenkins, etc.
• Faster testing time
• No navigation required
• Can capture multiple test conditions
– Different screen capture for each screen’s possible output
32
Create a User Library for Mockito
• Window -> Preferences
• Java -> Build Path -> User Libraries
• Add JavaDoc also!
33
Setup your HATS Project for Unit Testing
• Create an empty class com.ibm.eNetwork.HOD.ScreenHistory
– This is referenced by HATS program code, but is never used.
– Junit code will not run without
• Download Mockito
• Add Junit library to build path
• Add mockito library to build path
34
Mockito is well documented!
• Make sure you add the Javadoc location to your User Library
• Excellent example of GOOD documentation!
35
36
Getting Started with XMLUnit
How to setup your environment and write your first test
37
xmlUnit
• Test xml based files
• Uses Xpath under the covers
• Key Files to test:
– application.hap (project settings document)
– macro files (are all XML under the hood)
38
http://www.xmlunit.org/
Setup your first test
public class ApplicationHAPTest extends XMLTestCase {
@Before
public void setup() {
System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory",
"org.apache.xerces.jaxp.SAXParserFactoryImpl");
System.setProperty("javax.xml.transform.TransformerFactory",
"org.apache.xalan.processor.TransformerFactoryImpl");
XMLUnit.setIgnoreWhitespace(true);
. . .
}
39
Setup method to find your XML files
private void instantiateCommon() throws IOException, SAXException {
String dirfile = System.getProperty("user.dir") + HAP;
try {
// running on a local laptop
fromXML = new File(dirfile);
reader = new FileReader(fromXML);
} catch (Exception e) {
// running on the build server
fromXML = new File(“/home/my/workspace”+HAP);
reader = new FileReader(fromXML);
}
fromSource = new InputSource(reader);
hapdoc = XMLUnit.buildTestDocument(fromSource);
}
40
Testing the HATS Project Settings (Application.hap)
@Test
public void testCriticalEventsAreListedInProperOrder() {
String resetCookieState =
"/application/eventPriority/event[1][@name=‘resetCookieState']";
String SalesForceIntegration =
"/application/eventPriority/event[2][@name=‘SalesForceIntegration']";
String MainMenu =
"/application/eventPriority/event[3][@name='MainMenu']";
try {
instantiateCommon();
assertXpathExists(resetCookieState , hapdoc);
assertXpathExists(SalesForceIntegration, hapdoc);
assertXpathExists(MainMenu, hapdoc);
} catch (Exception e) {
e.printStackTrace();
fail("The event priority list has been changed. Please ensure
the correct order.");
} } 41
1
2
3
42
About Strongback Consulting
• IBM Advanced Business Partner
– Rational, WebSphere, ICS SVP certified
– Strongly focused on DevOps, Enterprise Modernization, and application infrastructure
– Key Industries Served: Finance, Insurance, Travel, Logistics, Healthcare, Manufacturing, Government
– Rational Design Partner for HATS and other Rational enterprise modernization technologies
Discover us at:
http://www.strongback.us
Subscribe to us at
http://blog.strongbackconsulting.com
Socialize with us on Facebook & LinkedIn
http://www.facebook.com/StrongbackConsulting
http://www.linkedin.com/company/290754
Find this presentation
and sample code
here!!

More Related Content

What's hot

Managing Content In Portal Wcm
Managing Content In Portal WcmManaging Content In Portal Wcm
Managing Content In Portal Wcm
tchaitanya
 
Agile in Action - Act 2: Development
Agile in Action - Act 2: DevelopmentAgile in Action - Act 2: Development
Agile in Action - Act 2: Development
Spiffy
 
Exceptional Digital Experience (Gartner PCC 2014)
Exceptional Digital Experience (Gartner PCC 2014)Exceptional Digital Experience (Gartner PCC 2014)
Exceptional Digital Experience (Gartner PCC 2014)
Edmund Johnson
 
Uklug 2011 administrator development synergy
Uklug 2011 administrator development synergyUklug 2011 administrator development synergy
Uklug 2011 administrator development synergy
dominion
 
Dynacache in WebSphere Portal Server
Dynacache in WebSphere Portal ServerDynacache in WebSphere Portal Server
Dynacache in WebSphere Portal Server
Rohit Kelapure
 
Agile in Action - Act 3: Testing
Agile in Action - Act 3: TestingAgile in Action - Act 3: Testing
Agile in Action - Act 3: Testing
Spiffy
 
Uklug 2011 client management
Uklug 2011 client managementUklug 2011 client management
Uklug 2011 client management
dominion
 
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application developmentWe4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT Group
 
Populating your domino directory or any domino database with tivoli directory...
Populating your domino directory or any domino database with tivoli directory...Populating your domino directory or any domino database with tivoli directory...
Populating your domino directory or any domino database with tivoli directory...
dominion
 

What's hot (20)

Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin CenterDeploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
 
Java Development on Bluemix
Java Development on BluemixJava Development on Bluemix
Java Development on Bluemix
 
Rational HATS and HIS v8 Overview
Rational HATS and HIS v8 OverviewRational HATS and HIS v8 Overview
Rational HATS and HIS v8 Overview
 
Managing Content In Portal Wcm
Managing Content In Portal WcmManaging Content In Portal Wcm
Managing Content In Portal Wcm
 
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
 
Workflow Management Software with IBM Lotus Notes, Business Process Managemen...
Workflow Management Software with IBM Lotus Notes, Business Process Managemen...Workflow Management Software with IBM Lotus Notes, Business Process Managemen...
Workflow Management Software with IBM Lotus Notes, Business Process Managemen...
 
Ibm bpm problem determination
Ibm bpm problem determinationIbm bpm problem determination
Ibm bpm problem determination
 
1812 icap-v1.3 0430
1812 icap-v1.3 04301812 icap-v1.3 0430
1812 icap-v1.3 0430
 
Agile in Action - Act 2: Development
Agile in Action - Act 2: DevelopmentAgile in Action - Act 2: Development
Agile in Action - Act 2: Development
 
Exceptional Digital Experience (Gartner PCC 2014)
Exceptional Digital Experience (Gartner PCC 2014)Exceptional Digital Experience (Gartner PCC 2014)
Exceptional Digital Experience (Gartner PCC 2014)
 
Uklug 2011 administrator development synergy
Uklug 2011 administrator development synergyUklug 2011 administrator development synergy
Uklug 2011 administrator development synergy
 
Dynacache in WebSphere Portal Server
Dynacache in WebSphere Portal ServerDynacache in WebSphere Portal Server
Dynacache in WebSphere Portal Server
 
Agile in Action - Act 3: Testing
Agile in Action - Act 3: TestingAgile in Action - Act 3: Testing
Agile in Action - Act 3: Testing
 
Uklug 2011 client management
Uklug 2011 client managementUklug 2011 client management
Uklug 2011 client management
 
A Beard, An App, A Blender
A Beard, An App, A BlenderA Beard, An App, A Blender
A Beard, An App, A Blender
 
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application developmentWe4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
 
Populating your domino directory or any domino database with tivoli directory...
Populating your domino directory or any domino database with tivoli directory...Populating your domino directory or any domino database with tivoli directory...
Populating your domino directory or any domino database with tivoli directory...
 
Pro JavaFX Platform - Building Enterprise Applications with JavaFX
Pro JavaFX Platform - Building Enterprise Applications with JavaFXPro JavaFX Platform - Building Enterprise Applications with JavaFX
Pro JavaFX Platform - Building Enterprise Applications with JavaFX
 
What's new in designer
What's new in designerWhat's new in designer
What's new in designer
 
Portal at the Speed of Light
Portal at the Speed of LightPortal at the Speed of Light
Portal at the Speed of Light
 

Similar to Tips for Developing and Testing IBM HATS Applications

OpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston MeetupOpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston Meetup
ragss
 
Was liberty at scale
Was liberty at scaleWas liberty at scale
Was liberty at scale
sflynn073
 
Sa106 – practical solutions for connections administrators
Sa106 – practical solutions for connections administratorsSa106 – practical solutions for connections administrators
Sa106 – practical solutions for connections administrators
Sharon James
 

Similar to Tips for Developing and Testing IBM HATS Applications (20)

AD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages AppsAD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages Apps
 
Service Testing & Virtualization in an Enterprise Environments
Service Testing & Virtualization in an Enterprise EnvironmentsService Testing & Virtualization in an Enterprise Environments
Service Testing & Virtualization in an Enterprise Environments
 
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
 
IBM Lotusphere 2013 AD109: Using the IBM® Sametime® Proxy SDK: WebSphere Port...
IBM Lotusphere 2013 AD109: Using the IBM® Sametime® Proxy SDK: WebSphere Port...IBM Lotusphere 2013 AD109: Using the IBM® Sametime® Proxy SDK: WebSphere Port...
IBM Lotusphere 2013 AD109: Using the IBM® Sametime® Proxy SDK: WebSphere Port...
 
Virtualization and Cloud Computing
Virtualization and Cloud ComputingVirtualization and Cloud Computing
Virtualization and Cloud Computing
 
OpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston MeetupOpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston Meetup
 
Code One 2018 maven
Code One 2018   mavenCode One 2018   maven
Code One 2018 maven
 
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...
 
An Introduction to Web Components
An Introduction to Web ComponentsAn Introduction to Web Components
An Introduction to Web Components
 
设计开发实效 Web2.0 应用程序
设计开发实效 Web2.0 应用程序设计开发实效 Web2.0 应用程序
设计开发实效 Web2.0 应用程序
 
Was liberty at scale
Was liberty at scaleWas liberty at scale
Was liberty at scale
 
IBM PureApplication System and Maximo
IBM PureApplication System and MaximoIBM PureApplication System and Maximo
IBM PureApplication System and Maximo
 
SOA Knowledge Kit, Developer Productivity and Performance Comparison Analysis
SOA Knowledge Kit, Developer Productivity  and Performance Comparison AnalysisSOA Knowledge Kit, Developer Productivity  and Performance Comparison Analysis
SOA Knowledge Kit, Developer Productivity and Performance Comparison Analysis
 
Operations and Security at Cloud Scale with Amazon EC2 System Manager - AWS S...
Operations and Security at Cloud Scale with Amazon EC2 System Manager - AWS S...Operations and Security at Cloud Scale with Amazon EC2 System Manager - AWS S...
Operations and Security at Cloud Scale with Amazon EC2 System Manager - AWS S...
 
Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?
 
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...
 
WinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release Pipelines
 
ENT401 Deep Dive with Amazon EC2 Systems Manager
ENT401 Deep Dive with Amazon EC2 Systems ManagerENT401 Deep Dive with Amazon EC2 Systems Manager
ENT401 Deep Dive with Amazon EC2 Systems Manager
 
Sa106 – practical solutions for connections administrators
Sa106 – practical solutions for connections administratorsSa106 – practical solutions for connections administrators
Sa106 – practical solutions for connections administrators
 
Pragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecturePragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecture
 

More from Strongback Consulting

IBM Innovate 2013: Making Rational HATS a Strategic Investment
IBM Innovate 2013: Making Rational HATS a Strategic InvestmentIBM Innovate 2013: Making Rational HATS a Strategic Investment
IBM Innovate 2013: Making Rational HATS a Strategic Investment
Strongback Consulting
 
IBM Innovate 2011- What every System i Developer Needs to Know
IBM Innovate 2011- What every System i Developer Needs to KnowIBM Innovate 2011- What every System i Developer Needs to Know
IBM Innovate 2011- What every System i Developer Needs to Know
Strongback Consulting
 
Using Dojo Javascript Framework with Rational HATS
Using Dojo Javascript Framework with Rational HATSUsing Dojo Javascript Framework with Rational HATS
Using Dojo Javascript Framework with Rational HATS
Strongback Consulting
 

More from Strongback Consulting (20)

IBM Collaborative Lifecycle Management Solution for DevOps v6
IBM Collaborative Lifecycle Management Solution for DevOps v6IBM Collaborative Lifecycle Management Solution for DevOps v6
IBM Collaborative Lifecycle Management Solution for DevOps v6
 
Patterns and Antipatterns for Adopting IBM DevOps Tools
Patterns and Antipatterns for Adopting IBM DevOps ToolsPatterns and Antipatterns for Adopting IBM DevOps Tools
Patterns and Antipatterns for Adopting IBM DevOps Tools
 
How Arcad Skipper pack works for the IBM i
How Arcad Skipper pack works for the IBM iHow Arcad Skipper pack works for the IBM i
How Arcad Skipper pack works for the IBM i
 
Being Smart about C/C++ Development on AIX and Linux
Being Smart about C/C++ Development on AIX and Linux Being Smart about C/C++ Development on AIX and Linux
Being Smart about C/C++ Development on AIX and Linux
 
Software Archaeology and Code Refactoring with Rational Developer for System ...
Software Archaeology and Code Refactoring with Rational Developer for System ...Software Archaeology and Code Refactoring with Rational Developer for System ...
Software Archaeology and Code Refactoring with Rational Developer for System ...
 
IBM Innovate 2013: Making Rational HATS a Strategic Investment
IBM Innovate 2013: Making Rational HATS a Strategic InvestmentIBM Innovate 2013: Making Rational HATS a Strategic Investment
IBM Innovate 2013: Making Rational HATS a Strategic Investment
 
Linux 101
Linux 101Linux 101
Linux 101
 
Rational collaborative-lifecycle-management-2012
Rational collaborative-lifecycle-management-2012Rational collaborative-lifecycle-management-2012
Rational collaborative-lifecycle-management-2012
 
Build Smarter User Interfaces for Legacy Applications with IBM Rational Host ...
Build Smarter User Interfaces for Legacy Applications with IBM Rational Host ...Build Smarter User Interfaces for Legacy Applications with IBM Rational Host ...
Build Smarter User Interfaces for Legacy Applications with IBM Rational Host ...
 
Collaborative Quality Management
Collaborative Quality ManagementCollaborative Quality Management
Collaborative Quality Management
 
Collaborative Lifecycle Managmenent - an Introduction
Collaborative Lifecycle Managmenent - an IntroductionCollaborative Lifecycle Managmenent - an Introduction
Collaborative Lifecycle Managmenent - an Introduction
 
IBM Innovate 2011- What every System i Developer Needs to Know
IBM Innovate 2011- What every System i Developer Needs to KnowIBM Innovate 2011- What every System i Developer Needs to Know
IBM Innovate 2011- What every System i Developer Needs to Know
 
Rational HATS overview 7.5.1
Rational HATS overview 7.5.1Rational HATS overview 7.5.1
Rational HATS overview 7.5.1
 
Using Dojo Javascript Framework with Rational HATS
Using Dojo Javascript Framework with Rational HATSUsing Dojo Javascript Framework with Rational HATS
Using Dojo Javascript Framework with Rational HATS
 
What's New in Rational Software for POWER Systems
What's New in Rational Software for POWER SystemsWhat's New in Rational Software for POWER Systems
What's New in Rational Software for POWER Systems
 
Rational Team Concertfor Power Customer Presentation02 09 10
Rational Team Concertfor Power Customer Presentation02 09 10Rational Team Concertfor Power Customer Presentation02 09 10
Rational Team Concertfor Power Customer Presentation02 09 10
 
Rational Quality Manager
Rational Quality ManagerRational Quality Manager
Rational Quality Manager
 
RTCi Demo Scenario
RTCi Demo ScenarioRTCi Demo Scenario
RTCi Demo Scenario
 
Daos Technical Overview Ne Lotus
Daos Technical Overview Ne LotusDaos Technical Overview Ne Lotus
Daos Technical Overview Ne Lotus
 
Rational HATS and CSS
Rational HATS and CSSRational HATS and CSS
Rational HATS and CSS
 

Recently uploaded

Revolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial IntelligenceRevolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
Precisely
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Recently uploaded (20)

AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial IntelligenceRevolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 

Tips for Developing and Testing IBM HATS Applications

  • 1. Tips for Developing and Testing IBM Host Access Transformation Services Applications Kenny Smith, Strongback Consulting
  • 2. About Strongback Consulting • IBM Advanced Business Partner – Rational, WebSphere, ICS SVP certified – Strongly focused on DevOps, Enterprise Modernization, and application infrastructure – Key Industries Served: Finance, Insurance, Travel, Logistics, Healthcare, Manufacturing, Government – Rational Design Partner for HATS and other Rational enterprise modernization technologies Discover us at: http://www.strongback.us Subscribe to us at http://blog.strongbackconsulting.com Socialize with us on Facebook & LinkedIn http://www.facebook.com/StrongbackConsulting http://www.linkedin.com/company/290754
  • 4. Overview of Development Cycle Uniquely tailor the user experience Custom widgets, components i18n Consume web services Make DB calls 3 months + Add Complex Customizations Customize some screens Implement macros Provide Web Services 1-2 month Moderate Customization Apply your own skin Modify default rendering rules < 1 week Custom Template Out of the box rendering Minimal changes < 4 hours Default 3
  • 5. Basic deployment • Keep It Simple • Basic out of the box implementation • Time: an afternoon 4
  • 6. Modest customization • “Skin” it to make it look more like your own company site • Global Rules and Text Replacement – Calendar pickers – Radio buttons for data entry • Customize only the most heavily used screens – Tweak subfiles and tables – Add navigational links 5
  • 7. Moderate customization • Macros • Producing Web services • Consuming web services • More screen customizations • Some custom Javascript functions • Integration with Portal • Mobile Application 6
  • 8. Heavy customization • Gung ho! • Create Custom Widgets and Components (i18n) • Connect to databases • Deep screen customizations • Integration with ERP or CRM • Dig under the hood and control at a Java API level – Custom screen recognition – Custom macro actions – Custom business logic 7
  • 9. General Guidelines For Renderings • Do the simplest thing that can possibly work • Customize by exception – Let default rendering do the work – Focus on getting Default Rendering rules working first • Don’t edit the HATS Javascript files – Put your customizations in separate .JS files • Edit or copy from the OOTB the CSS files – Use the OOTB class names • Accept that sometimes a quick fix in RPG/COBOL is easier than toiling over a crappy green screen issue 8
  • 10. General Rules for Web Services and I.O.’s • Develop macro thoroughly • Build "Happy path" first • Develop and account for "sad paths" (could be many of them) • Don't generate web service stubs until you've got the macro solid! • You can edit the I.O. template file if it does not generate what you need 9
  • 11. If you must do mockups • When doing big customizations…. • Write your mockups in plain HTML • Don’t do Photoshop or image based mockups • HTML can be directly used as stubs for the template & screen customizations 10
  • 12. Tips for using SCM with HATS How to avoid throwing coffee at your monitor 11
  • 13. General Tips • Team development in a single HATS app can be a challenge • Project settings document will require careful merging – WEB-INF/profiles/application.hap • Some files will drive you nuts – they change every save … and don’t need to be versioned • Use xmlUnit to unit test the application.hap – require a unit test run before code delivery **This is a setting that can be enforced in Team Concert *** slides coming up on these details later
  • 14. Avoid aggravation: Ignore these files • All log files HATS_EAR/logs • Web Content/WEB-INF/profiles/resourceUpdate.sts
  • 15. Use good naming conventions • Prefix all artifacts with a screen identifier • Package naming – [com | gov | net].<mycompany>.<appname>.<type> • Example: – com.strongback.crm.hats.domain – com.strongback.crm.hats.io – com.strongback.crm.hats.businessLogic – com.strongback.crm.hats.widgets – test.strongback.crm.hats.businessLogic 14
  • 16. Testing Unit Testing, Functional Testing, and Performance Testing 15
  • 17. Types of Testing • Policy (Accessibility) • Security • Performance – Load, stress – Can be automated • Functional – a.k.a. “Black Box” or User Acceptance Test • Unit – Written by developer, run by developer – Junit, xmlUnit – Always automated, and part of continuous build cycle 16
  • 18. Performance Testing • Tests should look at JVM GC over time – use WAS’ performance monitor tools to collect – Look at heap utilization, garbage collection stats • Test script should be a subset of real application usage, and timing • DON’T expect HATS interaction time to be as fast as an emulator!! – Emulator: Direct connection between user and host – HATS: 1 connection from host to WAS, 1 from WAS to user 17
  • 19. What adversely affects performance? • Excessive screen customizations (>100) • Poorly written custom Java code • Compression filter * • Database calls • Insufficient Memory in WAS • Poorly resourced LPAR • The perceived time between screens is the key indicator to watch for! 18
  • 20. Performance Testing Gotcha • Compression Filter – Designed to compress HTTP response • Will cause JVM crashes if not configured – Compression is one of the most expensive tasks a CPU can do – Default size is 0KB • Either disable, or set parameter > 1KB 19
  • 21. Functional Testing • Tools: RFT, Selenium • 3 priorities – Test screen customizations first – Test screens with high usage patterns next – Test a subset of default rendered screens • Think subfiles, tables, calendar pickers, etc. • Reuse test data! – Same RFT data can be used for pure terminal emulator tests – IBM Test Data Manager 20
  • 22. Record Terminal First • RFT can test 3270/5250 • use the same data to test HATS 21
  • 23. Unit Testing – what is it? • Developer written to test other code • Can be automated • Results in a pass or fail • Example: – Class to test the XML of the Project Settings document – Class to test a custom widget, or custom component 22
  • 24. Unit Testing: Why its difficult • Custom Java classes that use the HATS API – Business Logic – Screen Recognition – Integration Objects • Usual methods invoke the HATS Runtime Engine – i.e. requires a live connection 23 public static void execute( IBusinessLogicInformation blInfo) {….} This gets populated by the runtime environment
  • 25. Introducing Mocking and Stubbing • http://mockito.org/ • Mocking framework that creates a mock of a system • i.e. it mocks the behavior of the host 24
  • 26. How Mocking Works: 25 host screen i/z Host Mock this HATS Engine
  • 27. Normal Operation 26 Class under Test Dependent Class (IBusinessLogicInformation )
  • 28. Stubbing • Stubs return fixed results on each call • In this case, its fixed to return the desired screen when its getHostScreen() method is called 27 HostScreen hsr = readHostScreenFromFile(“myscreen.hsr”); Mockito.when(blInfo.getHostScreen()).thenReturn(hsr);
  • 29. Screen Captures: XML under the covers 28
  • 30. The HostScreen Object • Two Ways to Instantiate: • HostScreen hostScreen = blInfo.getHostScreen(); • HostScreen hostscreen = new HostScreen(screencapture); 29 This constructor requires an XML file!
  • 31. Create a convenience method to read the file Read the screen capture in as an XML Document, then pass to the HostScreen constructor protected HostScreen readHostScreenFromFile(String screenFileName) throws UnsupportedEncodingException, ParserConfigurationException, IOException , SAXException { URL url=this.getClass().getResource(screenFileName); String file= URLDecoder.decode(url.getFile(), "UTF-8"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document screencapture = builder.parse(file); HostScreen hostscreen = new HostScreen(screencapture); return hostscreen; } 30
  • 32. Now, mock and stub @Mock protected IBusinessLogicInformation blInfo; @Test public void testOperatorNameSetsCorrectValue() throws SAXException, IOException, ParserConfigurationException { OperatorName opname = new OperatorName(); HostScreen hostscreen = readHostScreenFromFile(SCREEN_MAIN_MENU); Mockito.when(blInfo.getHostScreen()).thenReturn(hostscreen); Hashtable hastableGVs = new Hashtable(1); Mockito.when(blInfo.getGlobalVariables()).thenReturn(hastableGVs); opname.execute(blInfo); com.ibm.hats.common.GlobalVariable operator = (com.ibm.hats.common.GlobalVariable) hastableGVs.get("operatorId"); assertEquals("KENNY SMITH (ASATKSM)", operator.getString().trim()); } 31 Mock the Business Logic Object This B.L. object gets the operator name from specific coordinates and sets a global variable Stub its getHostScreen() method
  • 33. Advantages of Mocking • Repeatable – Do not have to reset data after a test • Does not require connection to the system • Allows integration with a build system – i.e. Jazz Build Engine, Hudson, Jenkins, etc. • Faster testing time • No navigation required • Can capture multiple test conditions – Different screen capture for each screen’s possible output 32
  • 34. Create a User Library for Mockito • Window -> Preferences • Java -> Build Path -> User Libraries • Add JavaDoc also! 33
  • 35. Setup your HATS Project for Unit Testing • Create an empty class com.ibm.eNetwork.HOD.ScreenHistory – This is referenced by HATS program code, but is never used. – Junit code will not run without • Download Mockito • Add Junit library to build path • Add mockito library to build path 34
  • 36. Mockito is well documented! • Make sure you add the Javadoc location to your User Library • Excellent example of GOOD documentation! 35
  • 37. 36
  • 38. Getting Started with XMLUnit How to setup your environment and write your first test 37
  • 39. xmlUnit • Test xml based files • Uses Xpath under the covers • Key Files to test: – application.hap (project settings document) – macro files (are all XML under the hood) 38 http://www.xmlunit.org/
  • 40. Setup your first test public class ApplicationHAPTest extends XMLTestCase { @Before public void setup() { System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); XMLUnit.setIgnoreWhitespace(true); . . . } 39
  • 41. Setup method to find your XML files private void instantiateCommon() throws IOException, SAXException { String dirfile = System.getProperty("user.dir") + HAP; try { // running on a local laptop fromXML = new File(dirfile); reader = new FileReader(fromXML); } catch (Exception e) { // running on the build server fromXML = new File(“/home/my/workspace”+HAP); reader = new FileReader(fromXML); } fromSource = new InputSource(reader); hapdoc = XMLUnit.buildTestDocument(fromSource); } 40
  • 42. Testing the HATS Project Settings (Application.hap) @Test public void testCriticalEventsAreListedInProperOrder() { String resetCookieState = "/application/eventPriority/event[1][@name=‘resetCookieState']"; String SalesForceIntegration = "/application/eventPriority/event[2][@name=‘SalesForceIntegration']"; String MainMenu = "/application/eventPriority/event[3][@name='MainMenu']"; try { instantiateCommon(); assertXpathExists(resetCookieState , hapdoc); assertXpathExists(SalesForceIntegration, hapdoc); assertXpathExists(MainMenu, hapdoc); } catch (Exception e) { e.printStackTrace(); fail("The event priority list has been changed. Please ensure the correct order."); } } 41 1 2 3
  • 43. 42
  • 44. About Strongback Consulting • IBM Advanced Business Partner – Rational, WebSphere, ICS SVP certified – Strongly focused on DevOps, Enterprise Modernization, and application infrastructure – Key Industries Served: Finance, Insurance, Travel, Logistics, Healthcare, Manufacturing, Government – Rational Design Partner for HATS and other Rational enterprise modernization technologies Discover us at: http://www.strongback.us Subscribe to us at http://blog.strongbackconsulting.com Socialize with us on Facebook & LinkedIn http://www.facebook.com/StrongbackConsulting http://www.linkedin.com/company/290754 Find this presentation and sample code here!!