SlideShare a Scribd company logo
1 of 16
PHPUnit+WebDriver
Just Sharing Knowledge
Content
•
•
•
•
•
•
•
•
•

Our Problem In Existing System
TDD
Testing with MVC
PHPUnit
PHPUnit Terms
PHPUnit Test-Case Template
WebDriver
Best Practices
How To Install
Our Problem In Existing System
Dependency
+
Maintenance

•
•
•
•

Suite Dependency.
Code-maintenance.
Testing on same Joomla-kit.
Tightly-coupled and mix up testing.
Test Driven Development
•
•

Short development cycle.
Write test case before code.
PHPUnit
Unit Test :

•
•
•

Unit testing simply verify that individual units of code work as expected.
Try to make Robust Extension.
White-box testing

Selenium/WebDriver :

•
•
•

Not unit Test case
Focus only Acceptance-Testing (Validation+Verification) and UX
Black-box testing

PHPUnit

•
•
•
•
•

Testing Framework => Unit + Integration Testing
Reports of Code-coverage (in different formats like HTML , JSON,XML format etc)
Supported DB - MySql(i), Sqlite, PostgreSql, Oracle.
Known what breaks early on and Enforces code quality.
Benefits = Automation + confidence
PHPUnit Terms..
Test-Double
Problem : Method is depends on external service/component
PHPUnit Terms..
Test-Double
Solution : Replace external service/component object and provide same API i.e Test-Double
PHPUnit Terms
Stub

•
•

Stub is simple fake object. It just makes sure test runs smoothly.
Test can’t fail.

Mock

•
•

Mock is smarter stub. You verify Your test passes through it.
Test can fail.

SPY

•

You can call object in imitation on, and after you can assert how many times it called.

Fixtures

•
•
•
•

is a “known state” for testing application.
“set up” at the start of test.
“tear down” at the end of the test.
Shares this “states” over test methods.
PHPUnit Test-Case Template
PHPUnit command-line tool prints one character to indicate progress:

•
•
•
•
•

.(Dot) – Printed when a test succeeds.
I – Printed when the test is marked as being incomplete.
S – Printed when the test has been skipped.
F – Printed when an assertion fails.
E – Printed when an error occurs while running the test.
WebDriver
WebDriver
•

WebDriver – to control the browser
o WebDriver driver = new FirefoxDriver();

•
•
•
•
•
•

WebElement – to work with the elements on the page
IE, Firefox, Chrome, Safari, Opera etc
Windows, Linux, Solaris and other OS’s
Need to create own webdriver for each test environment
Events generated are the same as for manual testing
WebDriver.TargetLocator switchTo() – switching between the popup-E, alert, windows

WebDriver-Flow
WebDriver’s Driver
•
•
•
•
•
•
•

HtmlUnit Driver
Firefox Driver
Internet Explorer Driver
Chrome Driver
Opera Driver
iPhone Driver
Android Driver
Best Practices
•
•

Every behaviour should be covered by one test.

•
•

Mock external states and services.

•
•
•

Test class name have suffix “Test” like ClassNameTest

Test one unit at a Time (follow DRY Principle)(This should force you write non-overlapping code,
break all logic into units).
Should be independent each Test-Case(test-method). But Must be independent each TestSuites(Test-class).
File name should be strtolower(ClassNameTest)
The tests are public methods and The have prefix “test” like testMethod. (You can use
annotation @test)
How to Install
Setup PHPUnit
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear install phpunit/PHP_CodeCoverage
pear install --force --alldeps phpunit/phpunit
pear channel-discover pear.symfony.com
pear install pear.symfony.com/Yaml
sudo pear install phpunit/DbUnit
sudo pear install phpunit/PHPUnit_Selenium

Setup Sqlite
sudo apt-get install php5-sqlite
Install Latest Kit
download latest sqlite configure file from http://www.sqlite.org/download.html
extract kit -> cd _NEW_EXTRACT_KIT_
./configure
sudo make install

•
•
•
•
•

More Related Content

What's hot

Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Applitools
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
 
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
 
Selenium 2 - PyCon 2011
Selenium 2 - PyCon 2011Selenium 2 - PyCon 2011
Selenium 2 - PyCon 2011hugs
 
Practical Tips & Tricks for Selenium Test Automation
Practical Tips & Tricks for Selenium Test AutomationPractical Tips & Tricks for Selenium Test Automation
Practical Tips & Tricks for Selenium Test AutomationSauce Labs
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlotInterview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlotLearning Slot
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriverAnuraj S.L
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Applitools
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object patternMichael Palotas
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScriptSimon Guest
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using JavaF K
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 

What's hot (19)

Selenium IDE LOCATORS
Selenium IDE LOCATORSSelenium IDE LOCATORS
Selenium IDE LOCATORS
 
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Selenium ide made easy
Selenium ide made easySelenium ide made easy
Selenium ide made easy
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Selenium Handbook
Selenium HandbookSelenium Handbook
Selenium Handbook
 
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
 
Selenium 2 - PyCon 2011
Selenium 2 - PyCon 2011Selenium 2 - PyCon 2011
Selenium 2 - PyCon 2011
 
Practical Tips & Tricks for Selenium Test Automation
Practical Tips & Tricks for Selenium Test AutomationPractical Tips & Tricks for Selenium Test Automation
Practical Tips & Tricks for Selenium Test Automation
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlotInterview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object pattern
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScript
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using Java
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 

Similar to PhpUnit & web driver

Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdfLesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdfMinh Quân Đoàn
 
Testing Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupTesting Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupViktor Gamov
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software TestingMohammed Moishin
 
selenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at Scaleselenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at ScaleDavid Louvton
 
Growing Trends of Open Source UI Frameworks
Growing Trends of Open Source UI FrameworksGrowing Trends of Open Source UI Frameworks
Growing Trends of Open Source UI FrameworksSmartBear
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1tactqa
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1tactqa
 
Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014Sauce Labs
 
Selenium for everyone
Selenium for everyoneSelenium for everyone
Selenium for everyoneTft Us
 
Agile Testing at eBay
Agile Testing at eBayAgile Testing at eBay
Agile Testing at eBayDominik Dary
 
Selenium digitalinfobytes-120829005812-phpapp02
Selenium digitalinfobytes-120829005812-phpapp02Selenium digitalinfobytes-120829005812-phpapp02
Selenium digitalinfobytes-120829005812-phpapp02Kdeepapal Mishra
 
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A CookbookJavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A CookbookJorge Hidalgo
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4Knoldus Inc.
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using JenkinsRogue Wave Software
 

Similar to PhpUnit & web driver (20)

Test automation proposal
Test automation proposalTest automation proposal
Test automation proposal
 
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdfLesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
 
Testing Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupTesting Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user group
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
 
selenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at Scaleselenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at Scale
 
Growing Trends of Open Source UI Frameworks
Growing Trends of Open Source UI FrameworksGrowing Trends of Open Source UI Frameworks
Growing Trends of Open Source UI Frameworks
 
Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Selenium at Salesforce Scale
Selenium at Salesforce ScaleSelenium at Salesforce Scale
Selenium at Salesforce Scale
 
Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014
 
Automated ui-testing
Automated ui-testingAutomated ui-testing
Automated ui-testing
 
Selenium for everyone
Selenium for everyoneSelenium for everyone
Selenium for everyone
 
Agile Testing at eBay
Agile Testing at eBayAgile Testing at eBay
Agile Testing at eBay
 
Selenium digitalinfobytes-120829005812-phpapp02
Selenium digitalinfobytes-120829005812-phpapp02Selenium digitalinfobytes-120829005812-phpapp02
Selenium digitalinfobytes-120829005812-phpapp02
 
Basic Selenium Training
Basic Selenium TrainingBasic Selenium Training
Basic Selenium Training
 
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A CookbookJavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using Jenkins
 

Recently uploaded

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
#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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 

Recently uploaded (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
#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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 

PhpUnit & web driver

  • 2. Content • • • • • • • • • Our Problem In Existing System TDD Testing with MVC PHPUnit PHPUnit Terms PHPUnit Test-Case Template WebDriver Best Practices How To Install
  • 3. Our Problem In Existing System Dependency + Maintenance • • • • Suite Dependency. Code-maintenance. Testing on same Joomla-kit. Tightly-coupled and mix up testing.
  • 4. Test Driven Development • • Short development cycle. Write test case before code.
  • 5.
  • 6. PHPUnit Unit Test : • • • Unit testing simply verify that individual units of code work as expected. Try to make Robust Extension. White-box testing Selenium/WebDriver : • • • Not unit Test case Focus only Acceptance-Testing (Validation+Verification) and UX Black-box testing PHPUnit • • • • • Testing Framework => Unit + Integration Testing Reports of Code-coverage (in different formats like HTML , JSON,XML format etc) Supported DB - MySql(i), Sqlite, PostgreSql, Oracle. Known what breaks early on and Enforces code quality. Benefits = Automation + confidence
  • 7. PHPUnit Terms.. Test-Double Problem : Method is depends on external service/component
  • 8. PHPUnit Terms.. Test-Double Solution : Replace external service/component object and provide same API i.e Test-Double
  • 9. PHPUnit Terms Stub • • Stub is simple fake object. It just makes sure test runs smoothly. Test can’t fail. Mock • • Mock is smarter stub. You verify Your test passes through it. Test can fail. SPY • You can call object in imitation on, and after you can assert how many times it called. Fixtures • • • • is a “known state” for testing application. “set up” at the start of test. “tear down” at the end of the test. Shares this “states” over test methods.
  • 11. PHPUnit command-line tool prints one character to indicate progress: • • • • • .(Dot) – Printed when a test succeeds. I – Printed when the test is marked as being incomplete. S – Printed when the test has been skipped. F – Printed when an assertion fails. E – Printed when an error occurs while running the test.
  • 13. WebDriver • WebDriver – to control the browser o WebDriver driver = new FirefoxDriver(); • • • • • • WebElement – to work with the elements on the page IE, Firefox, Chrome, Safari, Opera etc Windows, Linux, Solaris and other OS’s Need to create own webdriver for each test environment Events generated are the same as for manual testing WebDriver.TargetLocator switchTo() – switching between the popup-E, alert, windows WebDriver-Flow
  • 14. WebDriver’s Driver • • • • • • • HtmlUnit Driver Firefox Driver Internet Explorer Driver Chrome Driver Opera Driver iPhone Driver Android Driver
  • 15. Best Practices • • Every behaviour should be covered by one test. • • Mock external states and services. • • • Test class name have suffix “Test” like ClassNameTest Test one unit at a Time (follow DRY Principle)(This should force you write non-overlapping code, break all logic into units). Should be independent each Test-Case(test-method). But Must be independent each TestSuites(Test-class). File name should be strtolower(ClassNameTest) The tests are public methods and The have prefix “test” like testMethod. (You can use annotation @test)
  • 16. How to Install Setup PHPUnit pear channel-discover pear.phpunit.de pear channel-discover components.ez.no pear install phpunit/PHP_CodeCoverage pear install --force --alldeps phpunit/phpunit pear channel-discover pear.symfony.com pear install pear.symfony.com/Yaml sudo pear install phpunit/DbUnit sudo pear install phpunit/PHPUnit_Selenium Setup Sqlite sudo apt-get install php5-sqlite Install Latest Kit download latest sqlite configure file from http://www.sqlite.org/download.html extract kit -> cd _NEW_EXTRACT_KIT_ ./configure sudo make install • • • • •