SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Downloaden Sie, um offline zu lesen
Automated
browser testing
By David Darke
Automated browser testing - David Darke | atomicsmash.co.uk 1
Automated browser testing - David Darke | atomicsmash.co.uk 2
Current testing trends
— Everyone does some form of testing (even if it isn't
structured)
— Testing results might not be logged anywhere (critical
paths)
— Lots of testing happens when a project launches, but
this may reduce as smaller features/updates are
deployed
Automated browser testing - David Darke | atomicsmash.co.uk 3
A lot of testing might be around requirements or client
questions:
Automated browser testing - David Darke | atomicsmash.co.uk 4
Standard browser testing isn't perfect
— Time consuming.
— VERY easy to forget to test something important.
— New developers on projects might not know what to
test.
— Dev aren't lazy, but most of the time there is
something more important they should be working on.
Automated browser testing - David Darke | atomicsmash.co.uk 5
WHY CAN'T WE
AUTOMATE
THIS?!?!
Automated browser testing - David Darke | atomicsmash.co.uk 6
You probably have heard
of unit testing
Automated browser testing - David Darke | atomicsmash.co.uk 7
With Unit Testing you break
down functionality into small
chunks (units) and validate one
bit at a time.
Automated browser testing - David Darke | atomicsmash.co.uk 8
For example...
A fake subscription purchase
— User logs in
— User makes purchase
— Get subscription information from the order
— Assign subscription to user
Automated browser testing - David Darke | atomicsmash.co.uk 9
— User logs in
— Get current user
— Validate
— Log user into site
— User makes purchase
— An order is created
— Order emails are sent
— Get subscription information from the order
— Check order for subscription product
— Sign up emails might be sent
— Assign subscription to user
— Check subscription was purchased
— Add subscription to user
— Check the subscription is active
Automated browser testing - David Darke | atomicsmash.co.uk 10
Automated browser testing - David Darke | atomicsmash.co.uk 11
Unit testing is great,
but simple browser testing
give you realistic user
experiences
Automated browser testing - David Darke | atomicsmash.co.uk 12
Automated browser testing - David Darke | atomicsmash.co.uk 13
What does it actually do though?
Automated browser testing - David Darke | atomicsmash.co.uk 14
Automated browser testing - David Darke | atomicsmash.co.uk 15
Install with 4 commands
https://github.com/unglud/dusker
Automated browser testing - David Darke | atomicsmash.co.uk 16
Here is a very simple test. This looks for text on a screen
public function testFindText()
{
$this->browse(function (Browser $browser) {
$browser->visit('/')
->assertSee('Text on Homepage');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 17
Here is a very simple test. This looks for text on screen
public function testFindText()
{
$this->browse(function (Browser $browser) {
$browser->visit('/')
->assertSee('Text on Homepage');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 18
Here is a very simple test. This looks for text on screen
public function testFindText()
{
$this->browse(function (Browser $browser) {
$browser->visit('/')
->assertSee('Text on Homepage');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 19
Here is a very simple test. This looks for text on screen
public function testFindText()
{
$this->browse(function (Browser $browser) {
$browser->visit('/')
->assertSee('Text on Homepage');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 20
You can even fill out a form:
public function testBasicForm()
{
$this->browse(function (Browser $browser) {
$browser->visit('/form-page/')
->type('name_field', 'Cool name')
->type('email_field', 'coolemail@gmail.com')
->press('Submit')
->waitForText('Thanks for contacting us!')
->assertSee('We will get in touch with you shortly');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 21
You can even fill out a form:
public function testBasicForm()
{
$this->browse(function (Browser $browser) {
$browser->visit('/form-page/')
->type('name_field', 'Cool name')
->type('email_field', 'coolemail@gmail.com')
->press('Submit')
->waitForText('Thanks for contacting us!')
->assertSee('We will get in touch with you shortly');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 22
You can even fill out a form:
public function testBasicForm()
{
$this->browse(function (Browser $browser) {
$browser->visit('/form-page/')
->type('name_field', 'Cool name')
->type('email_field', 'coolemail@gmail.com')
->press('Submit')
->waitForText('Thanks for contacting us!')
->assertSee('We will get in touch with you shortly');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 23
You can even fill out a form:
public function testBasicForm()
{
$this->browse(function (Browser $browser) {
$browser->visit('/form-page/')
->type('name_field', 'Cool name')
->type('email_field', 'coolemail@gmail.com')
->press('Submit')
->waitForText('Thanks for contacting us!')
->assertSee('We will get in touch with you shortly');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 24
You can even fill out a form:
public function testBasicForm()
{
$this->browse(function (Browser $browser) {
$browser->visit('/form-page/')
->type('name_field', 'Cool name')
->type('email_field', 'coolemail@gmail.com')
->press('Submit')
->waitForText('Thanks for contacting us!')
->assertSee('We will get in touch with you shortly');
});
}
Automated browser testing - David Darke | atomicsmash.co.uk 25
Run the tests with:
php artisan dusk
Automated browser testing - David Darke | atomicsmash.co.uk 26
DEMO TIME
Automated browser testing - David Darke | atomicsmash.co.uk 27
Automated browser testing - David Darke | atomicsmash.co.uk 28
!
Endless possibilities
— You don't have to just look at the frontend of the site
— You can use special testing databases
— Maybe even create special API endpoint to fact check
some tests
Automated browser testing - David Darke | atomicsmash.co.uk 29
When should these tests be added?
Automated browser testing - David Darke | atomicsmash.co.uk 30
When should these tests be added?
Automated browser testing - David Darke | atomicsmash.co.uk 31
How much of the codebase should I test?
Automated browser testing - David Darke | atomicsmash.co.uk 32
Standard browser testing isn't perfect.. let's review
— Time consuming.
— VERY easy to forget to test something important.
— New developers on projects might not know what to
test.
— Dev aren't lazy, but most of the time there is
something more important they should be working on.
Automated browser testing - David Darke | atomicsmash.co.uk 33
Do we actually use it?
Automated browser testing - David Darke | atomicsmash.co.uk 34
The future
http://go.testim.io/ai-based-testing-the-future-of-test-
automation
Automated browser testing - David Darke | atomicsmash.co.uk 35
THANKS!
Follow me:
@david_darke
Follow the studio:
@atomicsmash
Get presentation here:
https://github.com/daviddarke/automated-browser-
testing
Automated browser testing - David Darke | atomicsmash.co.uk 36
Questions?
Automated browser testing - David Darke | atomicsmash.co.uk 37

Weitere ähnliche Inhalte

Was ist angesagt?

Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon prague
hernanibf
 

Was ist angesagt? (20)

Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon prague
 
Cache is keeping you from reaching the full potential as a developer (word ca...
Cache is keeping you from reaching the full potential as a developer (word ca...Cache is keeping you from reaching the full potential as a developer (word ca...
Cache is keeping you from reaching the full potential as a developer (word ca...
 
Workshop On WP-CLI
Workshop On WP-CLIWorkshop On WP-CLI
Workshop On WP-CLI
 
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and BeyondWebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
 
How to make Ajax work for you
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for you
 
Optimizing your WordPress website
Optimizing your WordPress websiteOptimizing your WordPress website
Optimizing your WordPress website
 
WordPress Performance optimization
WordPress Performance optimizationWordPress Performance optimization
WordPress Performance optimization
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016
 
Capybara testing
Capybara testingCapybara testing
Capybara testing
 
Getting By Without "QA"
Getting By Without "QA"Getting By Without "QA"
Getting By Without "QA"
 
Using HTML5 sensibly
Using HTML5 sensiblyUsing HTML5 sensibly
Using HTML5 sensibly
 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audio
 
Frontend testing with Codeception
Frontend testing with CodeceptionFrontend testing with Codeception
Frontend testing with Codeception
 
The Future Of Web App Testing and How To Stop It
The Future Of Web App Testing and How To Stop ItThe Future Of Web App Testing and How To Stop It
The Future Of Web App Testing and How To Stop It
 
Gherkin for test automation in agile
Gherkin for test automation in agileGherkin for test automation in agile
Gherkin for test automation in agile
 
Mock Server Using WireMock
Mock Server Using WireMockMock Server Using WireMock
Mock Server Using WireMock
 
Cache is King
Cache is KingCache is King
Cache is King
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
Migrating Your WordPress Site to HTTPS - Getting it right the first time Word...
Migrating Your WordPress Site to HTTPS - Getting it right the first time Word...Migrating Your WordPress Site to HTTPS - Getting it right the first time Word...
Migrating Your WordPress Site to HTTPS - Getting it right the first time Word...
 

Ähnlich wie Automated browser testing

Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
Ran Mizrahi
 
WordPress Development Tools and Best Practices
WordPress Development Tools and Best PracticesWordPress Development Tools and Best Practices
WordPress Development Tools and Best Practices
Danilo Ercoli
 

Ähnlich wie Automated browser testing (20)

Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
 
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
 
Performance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverPerformance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & Webdriver
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
Gutenberg | How a WordPress studio adapted
Gutenberg | How a WordPress studio adaptedGutenberg | How a WordPress studio adapted
Gutenberg | How a WordPress studio adapted
 
How to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud SolutionsHow to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud Solutions
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
WordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for BeginnersWordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for Beginners
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
 
Test Automation using Ruby
Test Automation using Ruby Test Automation using Ruby
Test Automation using Ruby
 
The Strange DOM: Or How I Stopped Learned to Stop Worrying and Test for Acces...
The Strange DOM: Or How I Stopped Learned to Stop Worrying and Test for Acces...The Strange DOM: Or How I Stopped Learned to Stop Worrying and Test for Acces...
The Strange DOM: Or How I Stopped Learned to Stop Worrying and Test for Acces...
 
Front-End Test Fest Keynote: The State of the Union for Front End Testing.pdf
Front-End Test Fest Keynote: The State of the Union for Front End Testing.pdfFront-End Test Fest Keynote: The State of the Union for Front End Testing.pdf
Front-End Test Fest Keynote: The State of the Union for Front End Testing.pdf
 
WPDay Bologna 2013
WPDay Bologna 2013WPDay Bologna 2013
WPDay Bologna 2013
 
Cross Browser Testing: El reto de la eficiencia
Cross Browser Testing: El reto de la eficienciaCross Browser Testing: El reto de la eficiencia
Cross Browser Testing: El reto de la eficiencia
 
Azure from scratch part 4
Azure from scratch part 4Azure from scratch part 4
Azure from scratch part 4
 
Automate Thyself
Automate ThyselfAutomate Thyself
Automate Thyself
 
WordPress Development Tools and Best Practices
WordPress Development Tools and Best PracticesWordPress Development Tools and Best Practices
WordPress Development Tools and Best Practices
 
Run your Appium tests using Docker Android - AppiumConf 2019
Run your Appium tests using Docker Android - AppiumConf 2019Run your Appium tests using Docker Android - AppiumConf 2019
Run your Appium tests using Docker Android - AppiumConf 2019
 
Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

Automated browser testing

  • 1. Automated browser testing By David Darke Automated browser testing - David Darke | atomicsmash.co.uk 1
  • 2. Automated browser testing - David Darke | atomicsmash.co.uk 2
  • 3. Current testing trends — Everyone does some form of testing (even if it isn't structured) — Testing results might not be logged anywhere (critical paths) — Lots of testing happens when a project launches, but this may reduce as smaller features/updates are deployed Automated browser testing - David Darke | atomicsmash.co.uk 3
  • 4. A lot of testing might be around requirements or client questions: Automated browser testing - David Darke | atomicsmash.co.uk 4
  • 5. Standard browser testing isn't perfect — Time consuming. — VERY easy to forget to test something important. — New developers on projects might not know what to test. — Dev aren't lazy, but most of the time there is something more important they should be working on. Automated browser testing - David Darke | atomicsmash.co.uk 5
  • 6. WHY CAN'T WE AUTOMATE THIS?!?! Automated browser testing - David Darke | atomicsmash.co.uk 6
  • 7. You probably have heard of unit testing Automated browser testing - David Darke | atomicsmash.co.uk 7
  • 8. With Unit Testing you break down functionality into small chunks (units) and validate one bit at a time. Automated browser testing - David Darke | atomicsmash.co.uk 8
  • 9. For example... A fake subscription purchase — User logs in — User makes purchase — Get subscription information from the order — Assign subscription to user Automated browser testing - David Darke | atomicsmash.co.uk 9
  • 10. — User logs in — Get current user — Validate — Log user into site — User makes purchase — An order is created — Order emails are sent — Get subscription information from the order — Check order for subscription product — Sign up emails might be sent — Assign subscription to user — Check subscription was purchased — Add subscription to user — Check the subscription is active Automated browser testing - David Darke | atomicsmash.co.uk 10
  • 11. Automated browser testing - David Darke | atomicsmash.co.uk 11
  • 12. Unit testing is great, but simple browser testing give you realistic user experiences Automated browser testing - David Darke | atomicsmash.co.uk 12
  • 13. Automated browser testing - David Darke | atomicsmash.co.uk 13
  • 14. What does it actually do though? Automated browser testing - David Darke | atomicsmash.co.uk 14
  • 15. Automated browser testing - David Darke | atomicsmash.co.uk 15
  • 16. Install with 4 commands https://github.com/unglud/dusker Automated browser testing - David Darke | atomicsmash.co.uk 16
  • 17. Here is a very simple test. This looks for text on a screen public function testFindText() { $this->browse(function (Browser $browser) { $browser->visit('/') ->assertSee('Text on Homepage'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 17
  • 18. Here is a very simple test. This looks for text on screen public function testFindText() { $this->browse(function (Browser $browser) { $browser->visit('/') ->assertSee('Text on Homepage'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 18
  • 19. Here is a very simple test. This looks for text on screen public function testFindText() { $this->browse(function (Browser $browser) { $browser->visit('/') ->assertSee('Text on Homepage'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 19
  • 20. Here is a very simple test. This looks for text on screen public function testFindText() { $this->browse(function (Browser $browser) { $browser->visit('/') ->assertSee('Text on Homepage'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 20
  • 21. You can even fill out a form: public function testBasicForm() { $this->browse(function (Browser $browser) { $browser->visit('/form-page/') ->type('name_field', 'Cool name') ->type('email_field', 'coolemail@gmail.com') ->press('Submit') ->waitForText('Thanks for contacting us!') ->assertSee('We will get in touch with you shortly'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 21
  • 22. You can even fill out a form: public function testBasicForm() { $this->browse(function (Browser $browser) { $browser->visit('/form-page/') ->type('name_field', 'Cool name') ->type('email_field', 'coolemail@gmail.com') ->press('Submit') ->waitForText('Thanks for contacting us!') ->assertSee('We will get in touch with you shortly'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 22
  • 23. You can even fill out a form: public function testBasicForm() { $this->browse(function (Browser $browser) { $browser->visit('/form-page/') ->type('name_field', 'Cool name') ->type('email_field', 'coolemail@gmail.com') ->press('Submit') ->waitForText('Thanks for contacting us!') ->assertSee('We will get in touch with you shortly'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 23
  • 24. You can even fill out a form: public function testBasicForm() { $this->browse(function (Browser $browser) { $browser->visit('/form-page/') ->type('name_field', 'Cool name') ->type('email_field', 'coolemail@gmail.com') ->press('Submit') ->waitForText('Thanks for contacting us!') ->assertSee('We will get in touch with you shortly'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 24
  • 25. You can even fill out a form: public function testBasicForm() { $this->browse(function (Browser $browser) { $browser->visit('/form-page/') ->type('name_field', 'Cool name') ->type('email_field', 'coolemail@gmail.com') ->press('Submit') ->waitForText('Thanks for contacting us!') ->assertSee('We will get in touch with you shortly'); }); } Automated browser testing - David Darke | atomicsmash.co.uk 25
  • 26. Run the tests with: php artisan dusk Automated browser testing - David Darke | atomicsmash.co.uk 26
  • 27. DEMO TIME Automated browser testing - David Darke | atomicsmash.co.uk 27
  • 28. Automated browser testing - David Darke | atomicsmash.co.uk 28
  • 29. ! Endless possibilities — You don't have to just look at the frontend of the site — You can use special testing databases — Maybe even create special API endpoint to fact check some tests Automated browser testing - David Darke | atomicsmash.co.uk 29
  • 30. When should these tests be added? Automated browser testing - David Darke | atomicsmash.co.uk 30
  • 31. When should these tests be added? Automated browser testing - David Darke | atomicsmash.co.uk 31
  • 32. How much of the codebase should I test? Automated browser testing - David Darke | atomicsmash.co.uk 32
  • 33. Standard browser testing isn't perfect.. let's review — Time consuming. — VERY easy to forget to test something important. — New developers on projects might not know what to test. — Dev aren't lazy, but most of the time there is something more important they should be working on. Automated browser testing - David Darke | atomicsmash.co.uk 33
  • 34. Do we actually use it? Automated browser testing - David Darke | atomicsmash.co.uk 34
  • 36. THANKS! Follow me: @david_darke Follow the studio: @atomicsmash Get presentation here: https://github.com/daviddarke/automated-browser- testing Automated browser testing - David Darke | atomicsmash.co.uk 36
  • 37. Questions? Automated browser testing - David Darke | atomicsmash.co.uk 37