SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Les DSL et "fluent interface" pour les tests ASP.NET avec Selenium FluentSelenium
Content ,[object Object]
Best practices for testing
FluentSelenium
Conclusion
Selenium introduction Selenium is a suite of tools to automate web app testing across many platforms ,[object Object],[object Object],[object Object]
Here's a web test written with selenium selenium.Open( "Forum/AllPosts.aspx" ); selenium.WaitForPageToLoad( "8000" ); selenium.Click( "newPost" ); selenium.WaitForPageToLoad( "8000" ); selenium.Type( "//*[contains(@id, 'txtAuthor')]" ,  "Luc" ); selenium.Type( "//*[contains(@id, 'txtSubject')]" ,  "Simple example of the library." ); selenium.Click( "//*[contains(@id, 'btnSavePost')]" ); selenium.WaitForPageToLoad( "8000" ); Assert .AreEqual( "Luc" , selenium.GetText( "//table[contains(@id, 'grdPosts')]//tr[2]/td[2]" ));
Xpath introduction XPath is a structred XML query language Example : get the node of the employee with ID 123456 Employees/Employee[@EmployeeID='123456'] < Employees > < Employee   EmployeeID = &quot; 123456 &quot; > < LastName > Laporte </ LastName > < FirstName > Jacques </ FirstName > </ Employee > < Employee   EmployeeID = &quot; 654321 &quot; > < LastName > Gendron </ LastName > < FirstName > Pierre </ FirstName > </ Employee > </ Employees >
Xpath introduction XPath is a structred XML query language Example : get the last name of the employee with ID 123456 : Employees/Employee[@EmployeeID='123456']/LastName < Employees > < Employee   EmployeeID = &quot; 123456 &quot; > < LastName > Laporte </ LastName > < FirstName > Jacques </ FirstName > </ Employee > < Employee   EmployeeID = &quot; 654321 &quot; > < LastName > Gendron </ LastName > < FirstName > Pierre </ FirstName > </ Employee > </ Employees >
Selenium and XPath on HTML Because HTML is an XML derivative, XPath can be used to locate nodes in a HTML web page Example : ask selenium to click on the Save button : selenium.Click(“//input[@id='btnSubmit']”); selenium.WaitForPageToLoad(“5000”); < html > < body > < form > < div >Hello World !</ div > < input   type = &quot; submit &quot;   value = &quot; Save &quot;   id = &quot; btnSubmit &quot;  /> </ form > </ body > </ html >
Complete simple web test with selenium
Content ,[object Object],[object Object]
FluentSelenium
Conclusion
Good testing practices ,[object Object]
Test independance
Test clarity
Test coverage Should we aim for 100% coverage?
The trade offs
What does this mean? Integrated  tests Unit tests Test coverage
Best practices of test coverage ,[object Object]
Favor coverage through testing of services and domain objects over UI testing
Use patterns that facilitate testing close to the UI layer such as  MVC
Aim for coverage that gives you confidence in the quality of your deliverables
[object Object],Keep tests independent because: ,[object Object]
They will be easier to read
They will not be impacted by updates in other tests
Some things to consider... ,[object Object],[object Object]
Database: Sqlite ,[object Object]
Test Clarity ,[object Object]
Tests are code also. Team code quality rules should also be applied to tests.
XPATH is dangerous, use it wisely Use ID-based queries when possible //*[@id = 'searchResultCount']
Avoid exessive XPATH steps When requiring further qualification in searches only add necessary qualifiers Favor //*[@id='searchResults']//li[1] Over /html/body//div[@id='searchResults']/ul/li[1]
XPATH queries are not clear Xpath expressions are the kind of literal who's meaning can be hard to decipher.  Use constants. Favor selenium.GetText(SearchResultSummaryLocator); Over selenium.GetText( &quot;//*[@id='searchResultsSummary']&quot; );
Keep the test code clean ,[object Object]
Hard to read tests are hard maintain
Tests serve as application behavior documentation
The importance of language in tests ,[object Object]
[object Object],[object Object]
Users
Testers

Weitere ähnliche Inhalte

Was ist angesagt?

Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief exampleJeremy Kendall
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Developmentguestc8093a6
 
Beyond Unit Testing
Beyond Unit TestingBeyond Unit Testing
Beyond Unit TestingSøren Lund
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven DevelopmentTung Nguyen Thanh
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowRachid Kherrazi
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And RefactoringNaresh Jain
 
Unit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqUnit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqXPDays
 
TDD in PHP - Memphis PHP 2011-08-25
TDD in PHP - Memphis PHP 2011-08-25TDD in PHP - Memphis PHP 2011-08-25
TDD in PHP - Memphis PHP 2011-08-25Jeremy Kendall
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated TestingLee Englestone
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)David Ehringer
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010guest5639fa9
 
Testing the untestable
Testing the untestableTesting the untestable
Testing the untestableRoyKlein
 
Behaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlowBehaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlowPascal Laurin
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit TestingShaun Abram
 
A Brief Introduction to Zend_Form
A Brief Introduction to Zend_FormA Brief Introduction to Zend_Form
A Brief Introduction to Zend_FormJeremy Kendall
 
Unit testing
Unit testing Unit testing
Unit testing dubbu
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiFlorent Batard
 

Was ist angesagt? (20)

Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Beyond Unit Testing
Beyond Unit TestingBeyond Unit Testing
Beyond Unit Testing
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlow
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
Unit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqUnit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and Moq
 
TDD in PHP - Memphis PHP 2011-08-25
TDD in PHP - Memphis PHP 2011-08-25TDD in PHP - Memphis PHP 2011-08-25
TDD in PHP - Memphis PHP 2011-08-25
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated Testing
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
Reduce Reuse Refactor
Reduce Reuse RefactorReduce Reuse Refactor
Reduce Reuse Refactor
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Testing the untestable
Testing the untestableTesting the untestable
Testing the untestable
 
Behaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlowBehaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlow
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit Testing
 
A Brief Introduction to Zend_Form
A Brief Introduction to Zend_FormA Brief Introduction to Zend_Form
A Brief Introduction to Zend_Form
 
Unit testing
Unit testing Unit testing
Unit testing
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansai
 

Ähnlich wie FluentSelenium Presentation Code Camp09

Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Web App Testing With Selenium
Web App Testing With SeleniumWeb App Testing With Selenium
Web App Testing With Seleniumjoaopmaia
 
Functional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with FrankensteinFunctional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with Frankensteinvivek_prahlad
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Lars Vogel
 
Eclipse e4 on Java Forum Stuttgart 2010
Eclipse e4 on Java Forum Stuttgart 2010Eclipse e4 on Java Forum Stuttgart 2010
Eclipse e4 on Java Forum Stuttgart 2010Lars Vogel
 
Susan windsor soft test 16th november 2005
Susan windsor soft test   16th november 2005Susan windsor soft test   16th november 2005
Susan windsor soft test 16th november 2005David O'Dowd
 
Javazone 2010-lift-framework-public
Javazone 2010-lift-framework-publicJavazone 2010-lift-framework-public
Javazone 2010-lift-framework-publicTimothy Perrett
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotLearning Slot
 
Testing Ajax Web Applications
Testing Ajax Web ApplicationsTesting Ajax Web Applications
Testing Ajax Web ApplicationsTed Husted
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CIMartin de Keijzer
 
Automated Testing Of Web Applications Using XML
Automated  Testing Of  Web  Applications Using  XMLAutomated  Testing Of  Web  Applications Using  XML
Automated Testing Of Web Applications Using XMLdiongillard
 

Ähnlich wie FluentSelenium Presentation Code Camp09 (20)

Selenium
SeleniumSelenium
Selenium
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Web App Testing With Selenium
Web App Testing With SeleniumWeb App Testing With Selenium
Web App Testing With Selenium
 
Functional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with FrankensteinFunctional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with Frankenstein
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4
 
Eclipse e4 on Java Forum Stuttgart 2010
Eclipse e4 on Java Forum Stuttgart 2010Eclipse e4 on Java Forum Stuttgart 2010
Eclipse e4 on Java Forum Stuttgart 2010
 
Selenium
SeleniumSelenium
Selenium
 
Susan windsor soft test 16th november 2005
Susan windsor soft test   16th november 2005Susan windsor soft test   16th november 2005
Susan windsor soft test 16th november 2005
 
Javazone 2010-lift-framework-public
Javazone 2010-lift-framework-publicJavazone 2010-lift-framework-public
Javazone 2010-lift-framework-public
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
 
Testing Ajax Web Applications
Testing Ajax Web ApplicationsTesting Ajax Web Applications
Testing Ajax Web Applications
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CI
 
Struts2
Struts2Struts2
Struts2
 
Automated Testing Of Web Applications Using XML
Automated  Testing Of  Web  Applications Using  XMLAutomated  Testing Of  Web  Applications Using  XML
Automated Testing Of Web Applications Using XML
 
About Qtp 92
About Qtp 92About Qtp 92
About Qtp 92
 
About QTP 9.2
About QTP 9.2About QTP 9.2
About QTP 9.2
 
About Qtp_1 92
About Qtp_1 92About Qtp_1 92
About Qtp_1 92
 

Mehr von Pyxis Technologies

Pitié, ne construisez pas le nouveau pont Champlain en Agilité...
Pitié, ne construisez pas le nouveau pont Champlain en Agilité...Pitié, ne construisez pas le nouveau pont Champlain en Agilité...
Pitié, ne construisez pas le nouveau pont Champlain en Agilité...Pyxis Technologies
 
Sorry, the new Champlain Bridge can’t be built using Agile...
Sorry, the new Champlain Bridge can’t be built using Agile...Sorry, the new Champlain Bridge can’t be built using Agile...
Sorry, the new Champlain Bridge can’t be built using Agile...Pyxis Technologies
 
Développer votre logiciel interne : comment y parvenir sans investir une fort...
Développer votre logiciel interne : comment y parvenir sans investir une fort...Développer votre logiciel interne : comment y parvenir sans investir une fort...
Développer votre logiciel interne : comment y parvenir sans investir une fort...Pyxis Technologies
 
Agilité du point de vue de la gouvernance
Agilité du point de vue de la gouvernanceAgilité du point de vue de la gouvernance
Agilité du point de vue de la gouvernancePyxis Technologies
 
La gestion de portefeuille Agile - c'est pas compliqué!
La gestion de portefeuille Agile - c'est pas compliqué! La gestion de portefeuille Agile - c'est pas compliqué!
La gestion de portefeuille Agile - c'est pas compliqué! Pyxis Technologies
 
La valeur d'affaires comme indicateur de la gestion de projet - IIBA Montréal...
La valeur d'affaires comme indicateur de la gestion de projet - IIBA Montréal...La valeur d'affaires comme indicateur de la gestion de projet - IIBA Montréal...
La valeur d'affaires comme indicateur de la gestion de projet - IIBA Montréal...Pyxis Technologies
 
Agile BA - catalyseur, createur de valeur - BAFS 29 juin 2015 Geneve
Agile BA - catalyseur, createur de valeur - BAFS 29 juin 2015 Geneve Agile BA - catalyseur, createur de valeur - BAFS 29 juin 2015 Geneve
Agile BA - catalyseur, createur de valeur - BAFS 29 juin 2015 Geneve Pyxis Technologies
 
Estimation initiale dun projet agile de Mathieu Boisvert
Estimation initiale dun projet agile de Mathieu BoisvertEstimation initiale dun projet agile de Mathieu Boisvert
Estimation initiale dun projet agile de Mathieu BoisvertPyxis Technologies
 
Les attitudes doxiques dans les équipes et le syndrome du Titanic!
Les attitudes doxiques dans les équipes et le syndrome du Titanic!Les attitudes doxiques dans les équipes et le syndrome du Titanic!
Les attitudes doxiques dans les équipes et le syndrome du Titanic!Pyxis Technologies
 
La valeur d’affaires: L’indicateur qui peut changer le succès des projets
La valeur d’affaires: L’indicateur qui peut changer le succès des projetsLa valeur d’affaires: L’indicateur qui peut changer le succès des projets
La valeur d’affaires: L’indicateur qui peut changer le succès des projetsPyxis Technologies
 
Le rôle de l’architecte Agile - Mathieu Boisvert
Le rôle de l’architecte Agile - Mathieu BoisvertLe rôle de l’architecte Agile - Mathieu Boisvert
Le rôle de l’architecte Agile - Mathieu BoisvertPyxis Technologies
 
Agilité et la gestion du changement mboisvert - 15 octobre 2013
Agilité et la gestion du changement   mboisvert - 15 octobre 2013Agilité et la gestion du changement   mboisvert - 15 octobre 2013
Agilité et la gestion du changement mboisvert - 15 octobre 2013Pyxis Technologies
 
Comment être agile dans un contexte non lié aux TI ?
Comment être agile dans un contexte non lié aux TI ?Comment être agile dans un contexte non lié aux TI ?
Comment être agile dans un contexte non lié aux TI ?Pyxis Technologies
 
La revue d'itération intégrée… Et autres fabuleuses pratiques Agiles adaptées...
La revue d'itération intégrée… Et autres fabuleuses pratiques Agiles adaptées...La revue d'itération intégrée… Et autres fabuleuses pratiques Agiles adaptées...
La revue d'itération intégrée… Et autres fabuleuses pratiques Agiles adaptées...Pyxis Technologies
 
Choisir ses priorités: le développement incrémental de produit
Choisir ses priorités: le développement incrémental de produitChoisir ses priorités: le développement incrémental de produit
Choisir ses priorités: le développement incrémental de produitPyxis Technologies
 
Apprendre pour la performance et le bien-être
Apprendre pour la performance et le bien-êtreApprendre pour la performance et le bien-être
Apprendre pour la performance et le bien-êtrePyxis Technologies
 
L'agilité : de l'individu à l'organisation en passant par l'équipe
L'agilité : de l'individu à l'organisation en passant par l'équipeL'agilité : de l'individu à l'organisation en passant par l'équipe
L'agilité : de l'individu à l'organisation en passant par l'équipePyxis Technologies
 
Agile du point de vue d'un PMP
Agile du point de vue d'un PMPAgile du point de vue d'un PMP
Agile du point de vue d'un PMPPyxis Technologies
 

Mehr von Pyxis Technologies (20)

Pitié, ne construisez pas le nouveau pont Champlain en Agilité...
Pitié, ne construisez pas le nouveau pont Champlain en Agilité...Pitié, ne construisez pas le nouveau pont Champlain en Agilité...
Pitié, ne construisez pas le nouveau pont Champlain en Agilité...
 
Sorry, the new Champlain Bridge can’t be built using Agile...
Sorry, the new Champlain Bridge can’t be built using Agile...Sorry, the new Champlain Bridge can’t be built using Agile...
Sorry, the new Champlain Bridge can’t be built using Agile...
 
Développer votre logiciel interne : comment y parvenir sans investir une fort...
Développer votre logiciel interne : comment y parvenir sans investir une fort...Développer votre logiciel interne : comment y parvenir sans investir une fort...
Développer votre logiciel interne : comment y parvenir sans investir une fort...
 
Agilité du point de vue de la gouvernance
Agilité du point de vue de la gouvernanceAgilité du point de vue de la gouvernance
Agilité du point de vue de la gouvernance
 
La gestion de portefeuille Agile - c'est pas compliqué!
La gestion de portefeuille Agile - c'est pas compliqué! La gestion de portefeuille Agile - c'est pas compliqué!
La gestion de portefeuille Agile - c'est pas compliqué!
 
Introduction à Agile Lean
Introduction à Agile LeanIntroduction à Agile Lean
Introduction à Agile Lean
 
La valeur d'affaires comme indicateur de la gestion de projet - IIBA Montréal...
La valeur d'affaires comme indicateur de la gestion de projet - IIBA Montréal...La valeur d'affaires comme indicateur de la gestion de projet - IIBA Montréal...
La valeur d'affaires comme indicateur de la gestion de projet - IIBA Montréal...
 
Agile BA - catalyseur, createur de valeur - BAFS 29 juin 2015 Geneve
Agile BA - catalyseur, createur de valeur - BAFS 29 juin 2015 Geneve Agile BA - catalyseur, createur de valeur - BAFS 29 juin 2015 Geneve
Agile BA - catalyseur, createur de valeur - BAFS 29 juin 2015 Geneve
 
Estimation initiale dun projet agile de Mathieu Boisvert
Estimation initiale dun projet agile de Mathieu BoisvertEstimation initiale dun projet agile de Mathieu Boisvert
Estimation initiale dun projet agile de Mathieu Boisvert
 
Les attitudes doxiques dans les équipes et le syndrome du Titanic!
Les attitudes doxiques dans les équipes et le syndrome du Titanic!Les attitudes doxiques dans les équipes et le syndrome du Titanic!
Les attitudes doxiques dans les équipes et le syndrome du Titanic!
 
La valeur d’affaires: L’indicateur qui peut changer le succès des projets
La valeur d’affaires: L’indicateur qui peut changer le succès des projetsLa valeur d’affaires: L’indicateur qui peut changer le succès des projets
La valeur d’affaires: L’indicateur qui peut changer le succès des projets
 
Danser avec les polarités
Danser avec les polaritésDanser avec les polarités
Danser avec les polarités
 
Le rôle de l’architecte Agile - Mathieu Boisvert
Le rôle de l’architecte Agile - Mathieu BoisvertLe rôle de l’architecte Agile - Mathieu Boisvert
Le rôle de l’architecte Agile - Mathieu Boisvert
 
Agilité et la gestion du changement mboisvert - 15 octobre 2013
Agilité et la gestion du changement   mboisvert - 15 octobre 2013Agilité et la gestion du changement   mboisvert - 15 octobre 2013
Agilité et la gestion du changement mboisvert - 15 octobre 2013
 
Comment être agile dans un contexte non lié aux TI ?
Comment être agile dans un contexte non lié aux TI ?Comment être agile dans un contexte non lié aux TI ?
Comment être agile dans un contexte non lié aux TI ?
 
La revue d'itération intégrée… Et autres fabuleuses pratiques Agiles adaptées...
La revue d'itération intégrée… Et autres fabuleuses pratiques Agiles adaptées...La revue d'itération intégrée… Et autres fabuleuses pratiques Agiles adaptées...
La revue d'itération intégrée… Et autres fabuleuses pratiques Agiles adaptées...
 
Choisir ses priorités: le développement incrémental de produit
Choisir ses priorités: le développement incrémental de produitChoisir ses priorités: le développement incrémental de produit
Choisir ses priorités: le développement incrémental de produit
 
Apprendre pour la performance et le bien-être
Apprendre pour la performance et le bien-êtreApprendre pour la performance et le bien-être
Apprendre pour la performance et le bien-être
 
L'agilité : de l'individu à l'organisation en passant par l'équipe
L'agilité : de l'individu à l'organisation en passant par l'équipeL'agilité : de l'individu à l'organisation en passant par l'équipe
L'agilité : de l'individu à l'organisation en passant par l'équipe
 
Agile du point de vue d'un PMP
Agile du point de vue d'un PMPAgile du point de vue d'un PMP
Agile du point de vue d'un PMP
 

Kürzlich hochgeladen

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Kürzlich hochgeladen (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

FluentSelenium Presentation Code Camp09

  • 1. Les DSL et &quot;fluent interface&quot; pour les tests ASP.NET avec Selenium FluentSelenium
  • 2.
  • 6.
  • 7. Here's a web test written with selenium selenium.Open( &quot;Forum/AllPosts.aspx&quot; ); selenium.WaitForPageToLoad( &quot;8000&quot; ); selenium.Click( &quot;newPost&quot; ); selenium.WaitForPageToLoad( &quot;8000&quot; ); selenium.Type( &quot;//*[contains(@id, 'txtAuthor')]&quot; , &quot;Luc&quot; ); selenium.Type( &quot;//*[contains(@id, 'txtSubject')]&quot; , &quot;Simple example of the library.&quot; ); selenium.Click( &quot;//*[contains(@id, 'btnSavePost')]&quot; ); selenium.WaitForPageToLoad( &quot;8000&quot; ); Assert .AreEqual( &quot;Luc&quot; , selenium.GetText( &quot;//table[contains(@id, 'grdPosts')]//tr[2]/td[2]&quot; ));
  • 8. Xpath introduction XPath is a structred XML query language Example : get the node of the employee with ID 123456 Employees/Employee[@EmployeeID='123456'] < Employees > < Employee EmployeeID = &quot; 123456 &quot; > < LastName > Laporte </ LastName > < FirstName > Jacques </ FirstName > </ Employee > < Employee EmployeeID = &quot; 654321 &quot; > < LastName > Gendron </ LastName > < FirstName > Pierre </ FirstName > </ Employee > </ Employees >
  • 9. Xpath introduction XPath is a structred XML query language Example : get the last name of the employee with ID 123456 : Employees/Employee[@EmployeeID='123456']/LastName < Employees > < Employee EmployeeID = &quot; 123456 &quot; > < LastName > Laporte </ LastName > < FirstName > Jacques </ FirstName > </ Employee > < Employee EmployeeID = &quot; 654321 &quot; > < LastName > Gendron </ LastName > < FirstName > Pierre </ FirstName > </ Employee > </ Employees >
  • 10. Selenium and XPath on HTML Because HTML is an XML derivative, XPath can be used to locate nodes in a HTML web page Example : ask selenium to click on the Save button : selenium.Click(“//input[@id='btnSubmit']”); selenium.WaitForPageToLoad(“5000”); < html > < body > < form > < div >Hello World !</ div > < input type = &quot; submit &quot; value = &quot; Save &quot; id = &quot; btnSubmit &quot; /> </ form > </ body > </ html >
  • 11. Complete simple web test with selenium
  • 12.
  • 15.
  • 18. Test coverage Should we aim for 100% coverage?
  • 20. What does this mean? Integrated tests Unit tests Test coverage
  • 21.
  • 22. Favor coverage through testing of services and domain objects over UI testing
  • 23. Use patterns that facilitate testing close to the UI layer such as MVC
  • 24. Aim for coverage that gives you confidence in the quality of your deliverables
  • 25.
  • 26. They will be easier to read
  • 27. They will not be impacted by updates in other tests
  • 28.
  • 29.
  • 30.
  • 31. Tests are code also. Team code quality rules should also be applied to tests.
  • 32. XPATH is dangerous, use it wisely Use ID-based queries when possible //*[@id = 'searchResultCount']
  • 33. Avoid exessive XPATH steps When requiring further qualification in searches only add necessary qualifiers Favor //*[@id='searchResults']//li[1] Over /html/body//div[@id='searchResults']/ul/li[1]
  • 34. XPATH queries are not clear Xpath expressions are the kind of literal who's meaning can be hard to decipher. Use constants. Favor selenium.GetText(SearchResultSummaryLocator); Over selenium.GetText( &quot;//*[@id='searchResultsSummary']&quot; );
  • 35.
  • 36. Hard to read tests are hard maintain
  • 37. Tests serve as application behavior documentation
  • 38.
  • 39.
  • 40. Users
  • 42. Technical writers Write tests in your audiences language!
  • 43.
  • 44.
  • 45. Nhibernate and Linq use query oriented languages
  • 46. Users speak in the language of their needs and tasks
  • 47. Programmers tend to speak in terms of technical jargon In code this translates to the choice vocabulary used in class, method and variable names. Tests should use a DSL appropriate to the end user.
  • 48.
  • 49.
  • 52. Some examples shopper.Goto( &quot;Shopping/ShopOnline.aspx&quot; ); shopper.For(WelcomeMessageBox).ShouldSee( &quot;Welcome to Shop-e online!&quot; ); shopper.ShouldSee(FeaturedProductArea); shopper.For(FeaturedProductTitle).ShouldSee( &quot;blank CDs (10)&quot; ); shopper.For(FeaturedProductUnitePriceField).ShouldSee( &quot;5.00$&quot; );
  • 53. selenium.Open( &quot;Shopping/ShopOnline.aspx&quot; ); selenium.WaitForPageToLoad( &quot;1000&quot; ); Assert .AreEqual( &quot;Welcome to Shop-e online!&quot; , selenium.GetText( &quot;welcome&quot; )); Assert .IsTrue(selenium.IsVisible( &quot;featuredProduct&quot; )); Assert .AreEqual( &quot;blank CDs (10)&quot; , selenium.GetText( &quot;//*[@id='featuredProduct']//*[@id='title']&quot; )); Assert .AreEqual( &quot;5,00$&quot; , selenium.GetText( &quot;//*[@id='featuredProduct']//*[@id='price']&quot; ));
  • 54. ... forumUser.Goto( &quot;Forum/AllPosts.aspx&quot; ); forumUser.For(addPostButton).Clicks(); forumUser.WaitFor(newPostPageLoadWait); forumUser.For(subjectTextBox).Enters( &quot;Simple example of the library.&quot; ); forumUser.For(messagetTextBox).Enters( &quot;blah&quot; ); forumUser.For(savePostButton).Clicks(); forumUser.For(authorRequiredMessage).ShouldSee( &quot;The author is required.&quot; );
  • 55. The User The User class is the root of the DSL. All web test operations spawn from it. It is initialized as follows: var selenium = new DefaultSelenium (....); var forumUser = new User (selenium); Variables of type User should be named according to the role of the application user.
  • 56. Pushing XPATH out of the tests FluentSelenium uses typed locator objects ElementLocator WelcomeMessageBox = ElementLocator .WithId( &quot;welcome&quot; ); InputLocator SearchCatalogText = InputLocator .WithId( &quot;searchText&quot; ); ButtonLocator SearchCatalogButton = ButtonLocator .WithId( &quot;searchButton&quot; ); ElementLocator FeaturedProductTitle = ElementLocator .WithXpath( &quot;//*[@id='featuredProduct']//*[@id='title']&quot; ); Locator types determine what operations are available with a “For” shopper.For(SearchCatalogText).Enters( &quot;mouse&quot; ); shopper.For(SearchCatalogButton).Clicks();
  • 57. Application navigation Navigating to a specific address: goto shopper.Goto( &quot;Shopping/ShopOnline.aspx&quot; ); Navigating by clicking on links and buttons: click shopper.For(DiscountsButton).Clicks(); Waiting for page loading: WaitFor PageLoadWaitCondition SearchResultPageLoad = PageLoadWaitCondition .For( &quot;Shopping/SearchResults.aspx&quot; ); shopper.WaitFor(SearchResultPageLoad); Waiting for special conditions can be done by writing a custom implementation of IWaitCondition
  • 58. Validating page content Presence or absence of an element shopper.ShouldSee(WelcomeMessageBox); shopper.ShouldNotSee(SearchResults); Content of an page element shopper.For(SearchResultsSummary).ShouldSee( &quot;1 match found&quot; ); Custom validation, any implementation of IContentValidator class AnyNumberValidator : IContentValidator { public void Validate( ContentTester contentTester) .... shopper.For(OrderNumber).ShouldSee(AnyNumber);
  • 59. Testing table content Testing the content of a table row f orumUser.For(allPostsTable).Row(2).ShouldSee( &quot;Luc&quot; , &quot;Hello&quot; ); Jim Nothing Luc Hello Bob Goodbye Testing the content of a table column forumUser.For(allPostsTable).Column(1).ShouldSee( &quot;Jim&quot;, &quot;Luc&quot;, “Bob” ); Jim Nothing Luc Hello Bob Goodbye
  • 60. Other table operations Checking cell content forumUser.For(allPostsTable).Row(2).Column(3).ShouldSee( &quot;Present&quot; ); Cells have content forumUser.For(allPostsTable).Row(2).Column(3).For(replyPostButton).Click();
  • 61.
  • 62.
  • 63. Use extension methods to add test methods to the User class
  • 64.
  • 66.
  • 67.
  • 68. A simplified spin off of a framework developed for one of our clients. We expect to extend it with ideas and concepts that aren't yet implemented
  • 69. A work in progress
  • 70. A facilitator, not a solution
  • 71.