SlideShare a Scribd company logo
1 of 38
Download to read offline
Testing Seaside Components
C. David Shaffer
Department of Mathematics and Computer Science
Westminster College
Features
● Tests run on server = access to
component being tested
● Uses Smalltalk debugger
● Web test runner
● Available for Squeak and VisualWorks
(thanks to Michel Bany for VW port!)
First example
renderContentOn: html
html cssId: 'main'.
html span: 'hello'
Class SCTestComponent1
SCComponentTestCase subclass: #SCSampleComponentTest
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'SeasideTesting-Examples'
First example
testComponent1
self newApplicationWithRootClass: SCTestComponent1.
self establishSession.
self assert: (self lastResponse
stringWithId: 'main') = 'hello'
First example
Following anchors
renderContentOn: html
html cssId: 'first'.
html
anchorWithAction: [self firstPressed]
text: 'first link'.
Class SCAnchorDemo
firstPressed
self inform: 'pressed'
SCAnchorDemo
testAnchor
self newApplicationWithRootClass: SCAnchorDemo.
self establishSession.
self followAnchor: (self lastResponse
anchorWithId: 'first').
self assert: (self lastResponse
containsString: 'pressed')
“alternatively”
self assert: (self lastResponse
elementsNamed: 'h3') first
contentString = 'pressed'
Following anchors
lastResponse
Response parsed --> XML DOM (XMLElement)
Wrapped in SCSeasideResponse:
● Conveience methods for searching for XML elements
by id, class or name (tag)
● Method for wrapping parts in subclasses of
SCXMLElementWrapper. For example:
● SCSubmitButtonHtmlInput
● SCTextAreaHtmlInput
● SCSeasideForm
● SCSeasideAnchor
Finding anchors
anchorWithId: -- uses CSS id
anchorWithLabel: -- text inside A tag
anchors – collection of anchors in order of occurrence
Selected methods of SCSeasideResponse which
return SCSeasideAnchor(s)
Web TestRunner
Web TestRunner
Forms
renderContentOn: html
html form: [
html text: 'Name: ';
cssId: 'name';
textInputOn: #name of: self; br;
text: 'Age: ';
cssId: 'age';
textInputOn: #age of: self; br;
submitButtonWithAction:
[self displayInfo]text:'Display']
Class SCFormDemo
Class SCFormDemo
testDisplay
| form |
self newApplicationWithRootClass: SCFormDemo.
self establishSession.
form := self lastResponse forms first.
form textInputWithId: 'name' value: 'Bob Smith'.
form textInputWithId: 'age' value: '40'.
self
submitForm: form
pressingButton: form buttons first.
self assert: (self lastResponse
elementsNamed: 'h3') first
contentString =
'Hello Bob Smith. You are 40 years old.'
Forms
What do we test?
● State: often tests of state are less brittle
that tests of displayed content
● “answer”: components that provide a
Seaside answer
● Callbacks: components that provide
hooks
Seaside component more than just visual display
Need access to Seaside component
Testing the Counter (WACounter)
#component answers the instance of the
component used to satisfy the last request
Seaside may be keeping track of several
“versions” of that component registered with
#registerObjectForBacktracking:
Testing the Counter (WACounter)
Testing the Counter (WACounter)
testBack
self newApplicationWithRootClass: WACounter.
self establishSession.
self followAnchor: (self lastResponse
anchorWithLabel: '++').
self followAnchor: (self lastResponse
anchorWithLabel: '++').
Testing the Counter (WACounter)
testBack
self newApplicationWithRootClass: WACounter.
self establishSession.
self followAnchor: (self lastResponse
anchorWithLabel: '++').
self followAnchor: (self lastResponse
anchorWithLabel: '++').
self assert: self component count = 2.
Testing the Counter (WACounter)
testBack
self newApplicationWithRootClass: WACounter.
self establishSession.
self followAnchor: (self lastResponse
anchorWithLabel: '++').
self followAnchor: (self lastResponse
anchorWithLabel: '++').
self assert: self component count = 2.
self back.
Testing the Counter (WACounter)
testBack
self newApplicationWithRootClass: WACounter.
self establishSession.
self followAnchor: (self lastResponse
anchorWithLabel: '++').
self followAnchor: (self lastResponse
anchorWithLabel: '++').
self assert: self component count = 2.
self back.
self
followAnchor: (self lastResponse
anchorWithLabel: '++').
self assert: self component count = 2
Testing the Counter (WACounter)
Detecting answers
Detecting answers
Detecting answers
testYes
| form |
self newApplicationWithRootClass: WAYesOrNoDialog.
form := self establishSession forms first.
self
submitForm: form
pressingButton: (form buttonWithValue: 'Yes').
self assert: self answer
Detecting answers
Related methods:
answer – components last answer (error if none)
componentAnswered – boolean, has the component
answered?
componentAnswered: value – did the component
answer the specified value?
Testing callbacks
WAMiniCalendar
Must supply canSelectBlock to
instance – server creates instance!
Optional selectBlock callback
WAMiniCalendar
testSelectedDate
| selected anchors |
self
newApplicationWithRootClass: WAMiniCalendar
initializeWith: [:cal |
cal canSelectBlock: [:date | true].
cal selectBlock: [:date | selected := date]].
WAMiniCalendar
testSelectedDate
| selected anchors |
self
newApplicationWithRootClass: WAMiniCalendar
initializeWith: [:cal |
cal canSelectBlock: [:date | true].
cal selectBlock: [:date | selected := date]].
self establishSession.
self assert: selected isNil.
anchors := self lastResponse
anchorsWithLabel:
(Date today dayOfMonth printString).
self followAnchor: anchors last.
self assert: selected = Date today.
Other topics...
● Session also available
● Hook for configuring application
● History in Web TestRunner is “live”
● Marking interactions for visual
inspection
● http://www.cdshaffer.com/david/Seaside
Issues
● Visual appearance not tested
– Support for storing snapshots of pages for
human testers to view
● Client scripting (Javascript/DHTML) not
tested – Squelenium Demo?
Other free frameworks
● SmallHttpUnit
– VW, runs “outside” server
– Excellent API for accessing page elements
● HttpUnit
– Java, runs “outside” server
● Cactus
– Java, designed to run in-container like
SeasideTesting
● StrutsTestCase – like Cactus+HttpUnit
Conclusions
● Test components in isolation or in larger
application
● Can interact directly with
component/session to test state
● Can test back button behavior

More Related Content

What's hot

Unit Testing for Great Justice
Unit Testing for Great JusticeUnit Testing for Great Justice
Unit Testing for Great JusticeDomenic Denicola
 
Client side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karmaClient side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karmaAdam Klein
 
Angular Unit Testing from the Trenches
Angular Unit Testing from the TrenchesAngular Unit Testing from the Trenches
Angular Unit Testing from the TrenchesJustin James
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and EasybIakiv Kramarenko
 
Unit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and HowsUnit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and Howsatesgoral
 
Angular Unit Testing NDC Minn 2018
Angular Unit Testing NDC Minn 2018Angular Unit Testing NDC Minn 2018
Angular Unit Testing NDC Minn 2018Justin James
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
Testing React Applications
Testing React ApplicationsTesting React Applications
Testing React Applicationsstbaechler
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciollaAndrea Paciolla
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorJie-Wei Wu
 
How to build twitter bot using golang from scratch
How to build twitter bot using golang from scratchHow to build twitter bot using golang from scratch
How to build twitter bot using golang from scratchKaty Slemon
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Iakiv Kramarenko
 

What's hot (16)

Unit Testing for Great Justice
Unit Testing for Great JusticeUnit Testing for Great Justice
Unit Testing for Great Justice
 
Client side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karmaClient side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karma
 
Angular Unit Testing from the Trenches
Angular Unit Testing from the TrenchesAngular Unit Testing from the Trenches
Angular Unit Testing from the Trenches
 
Automated Testing ADF with Selenium
Automated Testing ADF with SeleniumAutomated Testing ADF with Selenium
Automated Testing ADF with Selenium
 
Vuejs testing
Vuejs testingVuejs testing
Vuejs testing
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
 
iOS testing
iOS testingiOS testing
iOS testing
 
Unit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and HowsUnit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and Hows
 
Angular Unit Testing NDC Minn 2018
Angular Unit Testing NDC Minn 2018Angular Unit Testing NDC Minn 2018
Angular Unit Testing NDC Minn 2018
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
Testing React Applications
Testing React ApplicationsTesting React Applications
Testing React Applications
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
How to build twitter bot using golang from scratch
How to build twitter bot using golang from scratchHow to build twitter bot using golang from scratch
How to build twitter bot using golang from scratch
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015
 

Similar to Testing Seaside Components

Extreme
ExtremeExtreme
ExtremeESUG
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsSeth McLaughlin
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance testBryan Liu
 
MVC Performance, Ember.js
MVC Performance, Ember.jsMVC Performance, Ember.js
MVC Performance, Ember.jsStanda Opichal
 
The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88Mahmoud Samir Fayed
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web developmentalice yang
 
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2Rob Tweed
 
Assurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring frameworkAssurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring frameworkGosuke Miyashita
 
Test automation in Loris
Test automation in LorisTest automation in Loris
Test automation in LorisWasion Wang
 
Code Kata: String Calculator in Flex
Code Kata: String Calculator in FlexCode Kata: String Calculator in Flex
Code Kata: String Calculator in FlexChris Farrell
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Roy de Kleijn
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component BehaviorsAndy Schwartz
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock FrameworkEugene Dvorkin
 
Let CodeCommit work for you
Let CodeCommit work for youLet CodeCommit work for you
Let CodeCommit work for youJorisConijn
 
How to develop frontend quiz app using vue js
How to develop frontend quiz app using vue jsHow to develop frontend quiz app using vue js
How to develop frontend quiz app using vue jsKaty Slemon
 

Similar to Testing Seaside Components (20)

Extreme
ExtremeExtreme
Extreme
 
Tdd iPhone For Dummies
Tdd iPhone For DummiesTdd iPhone For Dummies
Tdd iPhone For Dummies
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance test
 
MVC Performance, Ember.js
MVC Performance, Ember.jsMVC Performance, Ember.js
MVC Performance, Ember.js
 
The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web development
 
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
 
Testing
TestingTesting
Testing
 
Assurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring frameworkAssurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring framework
 
Django (Web Konferencia 2009)
Django (Web Konferencia 2009)Django (Web Konferencia 2009)
Django (Web Konferencia 2009)
 
ASP.NET MVC Extensibility
ASP.NET MVC ExtensibilityASP.NET MVC Extensibility
ASP.NET MVC Extensibility
 
Test automation in Loris
Test automation in LorisTest automation in Loris
Test automation in Loris
 
Code Kata: String Calculator in Flex
Code Kata: String Calculator in FlexCode Kata: String Calculator in Flex
Code Kata: String Calculator in Flex
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component Behaviors
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock Framework
 
Let CodeCommit work for you
Let CodeCommit work for youLet CodeCommit work for you
Let CodeCommit work for you
 
How to develop frontend quiz app using vue js
How to develop frontend quiz app using vue jsHow to develop frontend quiz app using vue js
How to develop frontend quiz app using vue js
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Testing Seaside Components

  • 1. Testing Seaside Components C. David Shaffer Department of Mathematics and Computer Science Westminster College
  • 2. Features ● Tests run on server = access to component being tested ● Uses Smalltalk debugger ● Web test runner ● Available for Squeak and VisualWorks (thanks to Michel Bany for VW port!)
  • 3. First example renderContentOn: html html cssId: 'main'. html span: 'hello' Class SCTestComponent1
  • 4. SCComponentTestCase subclass: #SCSampleComponentTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'SeasideTesting-Examples' First example
  • 5. testComponent1 self newApplicationWithRootClass: SCTestComponent1. self establishSession. self assert: (self lastResponse stringWithId: 'main') = 'hello' First example
  • 7. renderContentOn: html html cssId: 'first'. html anchorWithAction: [self firstPressed] text: 'first link'. Class SCAnchorDemo firstPressed self inform: 'pressed'
  • 9. testAnchor self newApplicationWithRootClass: SCAnchorDemo. self establishSession. self followAnchor: (self lastResponse anchorWithId: 'first'). self assert: (self lastResponse containsString: 'pressed') “alternatively” self assert: (self lastResponse elementsNamed: 'h3') first contentString = 'pressed' Following anchors
  • 10. lastResponse Response parsed --> XML DOM (XMLElement) Wrapped in SCSeasideResponse: ● Conveience methods for searching for XML elements by id, class or name (tag) ● Method for wrapping parts in subclasses of SCXMLElementWrapper. For example: ● SCSubmitButtonHtmlInput ● SCTextAreaHtmlInput ● SCSeasideForm ● SCSeasideAnchor
  • 11. Finding anchors anchorWithId: -- uses CSS id anchorWithLabel: -- text inside A tag anchors – collection of anchors in order of occurrence Selected methods of SCSeasideResponse which return SCSeasideAnchor(s)
  • 14. Forms
  • 15. renderContentOn: html html form: [ html text: 'Name: '; cssId: 'name'; textInputOn: #name of: self; br; text: 'Age: '; cssId: 'age'; textInputOn: #age of: self; br; submitButtonWithAction: [self displayInfo]text:'Display'] Class SCFormDemo
  • 17. testDisplay | form | self newApplicationWithRootClass: SCFormDemo. self establishSession. form := self lastResponse forms first. form textInputWithId: 'name' value: 'Bob Smith'. form textInputWithId: 'age' value: '40'. self submitForm: form pressingButton: form buttons first. self assert: (self lastResponse elementsNamed: 'h3') first contentString = 'Hello Bob Smith. You are 40 years old.' Forms
  • 18. What do we test? ● State: often tests of state are less brittle that tests of displayed content ● “answer”: components that provide a Seaside answer ● Callbacks: components that provide hooks Seaside component more than just visual display
  • 19. Need access to Seaside component
  • 20. Testing the Counter (WACounter) #component answers the instance of the component used to satisfy the last request Seaside may be keeping track of several “versions” of that component registered with #registerObjectForBacktracking:
  • 21. Testing the Counter (WACounter)
  • 22. Testing the Counter (WACounter)
  • 23. testBack self newApplicationWithRootClass: WACounter. self establishSession. self followAnchor: (self lastResponse anchorWithLabel: '++'). self followAnchor: (self lastResponse anchorWithLabel: '++'). Testing the Counter (WACounter)
  • 24. testBack self newApplicationWithRootClass: WACounter. self establishSession. self followAnchor: (self lastResponse anchorWithLabel: '++'). self followAnchor: (self lastResponse anchorWithLabel: '++'). self assert: self component count = 2. Testing the Counter (WACounter)
  • 25. testBack self newApplicationWithRootClass: WACounter. self establishSession. self followAnchor: (self lastResponse anchorWithLabel: '++'). self followAnchor: (self lastResponse anchorWithLabel: '++'). self assert: self component count = 2. self back. Testing the Counter (WACounter)
  • 26. testBack self newApplicationWithRootClass: WACounter. self establishSession. self followAnchor: (self lastResponse anchorWithLabel: '++'). self followAnchor: (self lastResponse anchorWithLabel: '++'). self assert: self component count = 2. self back. self followAnchor: (self lastResponse anchorWithLabel: '++'). self assert: self component count = 2 Testing the Counter (WACounter)
  • 29. Detecting answers testYes | form | self newApplicationWithRootClass: WAYesOrNoDialog. form := self establishSession forms first. self submitForm: form pressingButton: (form buttonWithValue: 'Yes'). self assert: self answer
  • 30. Detecting answers Related methods: answer – components last answer (error if none) componentAnswered – boolean, has the component answered? componentAnswered: value – did the component answer the specified value?
  • 32. WAMiniCalendar Must supply canSelectBlock to instance – server creates instance! Optional selectBlock callback
  • 33. WAMiniCalendar testSelectedDate | selected anchors | self newApplicationWithRootClass: WAMiniCalendar initializeWith: [:cal | cal canSelectBlock: [:date | true]. cal selectBlock: [:date | selected := date]].
  • 34. WAMiniCalendar testSelectedDate | selected anchors | self newApplicationWithRootClass: WAMiniCalendar initializeWith: [:cal | cal canSelectBlock: [:date | true]. cal selectBlock: [:date | selected := date]]. self establishSession. self assert: selected isNil. anchors := self lastResponse anchorsWithLabel: (Date today dayOfMonth printString). self followAnchor: anchors last. self assert: selected = Date today.
  • 35. Other topics... ● Session also available ● Hook for configuring application ● History in Web TestRunner is “live” ● Marking interactions for visual inspection ● http://www.cdshaffer.com/david/Seaside
  • 36. Issues ● Visual appearance not tested – Support for storing snapshots of pages for human testers to view ● Client scripting (Javascript/DHTML) not tested – Squelenium Demo?
  • 37. Other free frameworks ● SmallHttpUnit – VW, runs “outside” server – Excellent API for accessing page elements ● HttpUnit – Java, runs “outside” server ● Cactus – Java, designed to run in-container like SeasideTesting ● StrutsTestCase – like Cactus+HttpUnit
  • 38. Conclusions ● Test components in isolation or in larger application ● Can interact directly with component/session to test state ● Can test back button behavior