This document summarizes a presentation on using Behat and Mink for automated acceptance testing. It discusses how Behat and Mink allow developing automated tests from user stories and acceptance criteria. This ensures developers and clients have a shared understanding of requirements and that new features do not break existing functionality. Tests can be run quickly against different environments and browsers. The presentation provides an overview of Behat and Mink components and how to set up a test suite with Composer. It also covers best practices like writing examples and using tags, profiles and hooks.
El proceso de desarrollo de software involucra una gran cantidad de recursos, la elección de dichos recursos sin duda puede ayudarnos a marcar la diferencia en el resultado final.
Estos recursos pueden ser de muchos tipos, en este webminar nos enfocaremos a herramientas de software que nos permitirán mejorar nuestro proceso de desarrollo, aprovechando los beneficios del modelo openSource.
Veremos algunos criterios para elegir la herramientas de construcción, IDE de desarrollo, frameworks de testing, así como herramientas para integrar continuamente el código, así como herramientas para generar métricas.
Gestión de requisitos y su trazabilidad en la Gestión de Servicios TIOVERTI
Los marcos y modelos para la gestión de servicios TI hacen hincapié en la importancia de la gestión de requisitos, siendo especialmente relevante en procesos como la gestión de la cartera de servicio, la gestión de nivel de servicio y la gestión de cambios, entre otros.
La trazabilidad de requisitos, además, nos facilita la conexión entre aspectos de negocio y requisitos, aportando valor, ampliando la relación entre elementos de configuración dentro del sistema de gestión, y su trazabilidad entre los diferentes elementos de configuración (servicios, procesos, diseños, arquitecturas, políticas, procedimientos, planes…) y los requisitos, con un alto nivel de granularidad, de forma individual para cada uno de ellos, consiguiendo también de esta forma un alto y profundo nivel de análisis en la evaluación de impactos y riesgos. Esto además aporta una minimización de costes, gracias a la disminución de re-trabajo.
SEMINARIO WEB - El ABC del Test Automation: ¿Qué, por qué, cuando y cómo?Belatrix Software
No te quedes afuera de la nueva tendencia del test automation y conocé a fondo sobre este tema.
Tópicos:
- Introducción a la automatización.
- Cuándo automatizar.
- Ventajas y desventajas de la automatización.
- Herramientas de automatización.
El proceso de desarrollo de software involucra una gran cantidad de recursos, la elección de dichos recursos sin duda puede ayudarnos a marcar la diferencia en el resultado final.
Estos recursos pueden ser de muchos tipos, en este webminar nos enfocaremos a herramientas de software que nos permitirán mejorar nuestro proceso de desarrollo, aprovechando los beneficios del modelo openSource.
Veremos algunos criterios para elegir la herramientas de construcción, IDE de desarrollo, frameworks de testing, así como herramientas para integrar continuamente el código, así como herramientas para generar métricas.
Gestión de requisitos y su trazabilidad en la Gestión de Servicios TIOVERTI
Los marcos y modelos para la gestión de servicios TI hacen hincapié en la importancia de la gestión de requisitos, siendo especialmente relevante en procesos como la gestión de la cartera de servicio, la gestión de nivel de servicio y la gestión de cambios, entre otros.
La trazabilidad de requisitos, además, nos facilita la conexión entre aspectos de negocio y requisitos, aportando valor, ampliando la relación entre elementos de configuración dentro del sistema de gestión, y su trazabilidad entre los diferentes elementos de configuración (servicios, procesos, diseños, arquitecturas, políticas, procedimientos, planes…) y los requisitos, con un alto nivel de granularidad, de forma individual para cada uno de ellos, consiguiendo también de esta forma un alto y profundo nivel de análisis en la evaluación de impactos y riesgos. Esto además aporta una minimización de costes, gracias a la disminución de re-trabajo.
SEMINARIO WEB - El ABC del Test Automation: ¿Qué, por qué, cuando y cómo?Belatrix Software
No te quedes afuera de la nueva tendencia del test automation y conocé a fondo sobre este tema.
Tópicos:
- Introducción a la automatización.
- Cuándo automatizar.
- Ventajas y desventajas de la automatización.
- Herramientas de automatización.
I gave this talk at Velocity NY 2013, and it covers the installation and use of a private WebPagetest instance, as well as the open source tool wpt-script which Etsy built.
Monitoring Behavioral Driven Infrastructures mit Cucumber-Nagios by Mike AdolphsNETWAYS
In zunehmend komplexeren IT-Infrastrukturen wird es immer wichtiger, nicht nur zu erfassen, ob ein Dienst läuft, sondern auch, ob dessen volle Funktionalität gewährleistet ist. Der am elegantesten konfigurierte Webserver nützt schliesslich nichts, wenn er den falschen Inhalt ausliefert!
Das von Lindsay Holmwood geschriebene Nagios plugin cucumber-nagios tritt an, dieses Problem zu lösen und ermöglicht die Überwachung des Verhaltens eines Dienstes mittels Integrationstests.
Der Vortrag umfasst erklärende Worte zum Thema "Behavioral Driven Infrastructure", eine generelle Einführung zu cucumber, sowie cucumber-nagios und die Vorstellung einzelner Features anhand eines Live-Beispiels.
GraphQL Without a Database | Frontend Developer LoveRoy Derks
Your frontend developers are pushing to get started with GraphQL, but you don’t have the backend capacity to migrate your existing REST APIs to GraphQL? Or you want to have a GraphQL API next to your existing endpoints that are based on REST, without having to rewrite all your controllers? In this talk I’ll show how to wrap existing REST APIs into one single GraphQL endpoint on both the client and server side. This allows you to access the power of GraphQL without having to change any of your existing code or connect to a database.
Greenfield projects are awesome – you can develop highest quality application using best practices on the market. But what if your bread actually is Legacy projects? Does it mean that you need to descend into darkness of QA absence? This talk will show you how to be successful even with the oldest legacy projects out there through the introduction of Agile processes and tools like Behat.
Tek 2013 - Building Web Apps from a New Angle with AngularJSPablo Godel
AngularJS is a new JavaScript framework, backed by Google, for building powerful, complex and rich client-side web applications. We will go over the features and basics of building a web application with AngularJS and we will demonstrate how to communicate with a REST server built with PHP.
Lone StarPHP 2013 - Building Web Apps from a New AnglePablo Godel
AngularJS is a new JavaScript framework, backed by Google, for building powerful, complex and rich client-side web applications. We will go over the features and basics of building a web application with AngularJS and we will demonstrate how to communitate with a REST server built with PHP.
Delivered at Velocity Europe in Barcelona, this talk introduces "ops" people to the idea of user centered design, touching on several techniques long used in the design world, and talks about how those ideas might be applied to software and processes that we use every day.
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...Lincoln III
PrettyFaces: SEO, Dynamic Parameters, Bookmarks, and Navigation for JSF / JSF2 - As presented at JSFSummit2009 in Orlando Florida.
Why should we use PrettyFaces?
Backbone.js helps structure you javascript application code in a scalable way.
In this keynote I demonstrate how to use it in a simple walk-through example, and discuss the advantages of using an MVC framework.
Discover the Possibilities of the Jira Cloud Asset APIAtlassian
With the new assets management API for Jira Cloud, developers can bring a lot more context into Jira to create a faster and more powerful issue resolution experience.
Join Andrea, a developer on Jira Service Desk, as she gives a holistic overview of asset management in Jira Cloud. We’ll step through an ideal end-to-end user experience from help seekers raising a request for their laptop, to an agent resolution. In this talk, you’ll learn what powers these experiences and exactly how to create them using the Jira Cloud Assets API and integration points.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
More Related Content
Similar to Phpday - Automated acceptance testing with Behat and Mink
I gave this talk at Velocity NY 2013, and it covers the installation and use of a private WebPagetest instance, as well as the open source tool wpt-script which Etsy built.
Monitoring Behavioral Driven Infrastructures mit Cucumber-Nagios by Mike AdolphsNETWAYS
In zunehmend komplexeren IT-Infrastrukturen wird es immer wichtiger, nicht nur zu erfassen, ob ein Dienst läuft, sondern auch, ob dessen volle Funktionalität gewährleistet ist. Der am elegantesten konfigurierte Webserver nützt schliesslich nichts, wenn er den falschen Inhalt ausliefert!
Das von Lindsay Holmwood geschriebene Nagios plugin cucumber-nagios tritt an, dieses Problem zu lösen und ermöglicht die Überwachung des Verhaltens eines Dienstes mittels Integrationstests.
Der Vortrag umfasst erklärende Worte zum Thema "Behavioral Driven Infrastructure", eine generelle Einführung zu cucumber, sowie cucumber-nagios und die Vorstellung einzelner Features anhand eines Live-Beispiels.
GraphQL Without a Database | Frontend Developer LoveRoy Derks
Your frontend developers are pushing to get started with GraphQL, but you don’t have the backend capacity to migrate your existing REST APIs to GraphQL? Or you want to have a GraphQL API next to your existing endpoints that are based on REST, without having to rewrite all your controllers? In this talk I’ll show how to wrap existing REST APIs into one single GraphQL endpoint on both the client and server side. This allows you to access the power of GraphQL without having to change any of your existing code or connect to a database.
Greenfield projects are awesome – you can develop highest quality application using best practices on the market. But what if your bread actually is Legacy projects? Does it mean that you need to descend into darkness of QA absence? This talk will show you how to be successful even with the oldest legacy projects out there through the introduction of Agile processes and tools like Behat.
Tek 2013 - Building Web Apps from a New Angle with AngularJSPablo Godel
AngularJS is a new JavaScript framework, backed by Google, for building powerful, complex and rich client-side web applications. We will go over the features and basics of building a web application with AngularJS and we will demonstrate how to communicate with a REST server built with PHP.
Lone StarPHP 2013 - Building Web Apps from a New AnglePablo Godel
AngularJS is a new JavaScript framework, backed by Google, for building powerful, complex and rich client-side web applications. We will go over the features and basics of building a web application with AngularJS and we will demonstrate how to communitate with a REST server built with PHP.
Delivered at Velocity Europe in Barcelona, this talk introduces "ops" people to the idea of user centered design, touching on several techniques long used in the design world, and talks about how those ideas might be applied to software and processes that we use every day.
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...Lincoln III
PrettyFaces: SEO, Dynamic Parameters, Bookmarks, and Navigation for JSF / JSF2 - As presented at JSFSummit2009 in Orlando Florida.
Why should we use PrettyFaces?
Backbone.js helps structure you javascript application code in a scalable way.
In this keynote I demonstrate how to use it in a simple walk-through example, and discuss the advantages of using an MVC framework.
Discover the Possibilities of the Jira Cloud Asset APIAtlassian
With the new assets management API for Jira Cloud, developers can bring a lot more context into Jira to create a faster and more powerful issue resolution experience.
Join Andrea, a developer on Jira Service Desk, as she gives a holistic overview of asset management in Jira Cloud. We’ll step through an ideal end-to-end user experience from help seekers raising a request for their laptop, to an agent resolution. In this talk, you’ll learn what powers these experiences and exactly how to create them using the Jira Cloud Assets API and integration points.
Similar to Phpday - Automated acceptance testing with Behat and Mink (20)
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2. LET ME INTRODUCE MYSELF
• @Richard_Tuin
• Software developer from the Netherlands
• Particular interest in QA
• Working for
Saturday, May 18, 13
3. INEFFICIENCY
• Different view on scope and resulting product
• Clients don’t get a feel of how they will use the product
• “I like what you’ve built, but it doesn’t do what i meant”
• “Thanks for this new feature, but now x stopped working!”
Saturday, May 18, 13
4. INEFFICIENCY
• Different view on scope and resulting product
• Clients don’t get a feel of how they will use the product
• “I like what you’ve built, but it doesn’t do what i meant”
• “Thanks for this new feature, but now x stopped working!”
Saturday, May 18, 13
5. BECAUSE
• ... the dev team and the client have the same goal
• ... we want to know that what we build has value
• ... we want to deliver consistent quality
Saturday, May 18, 13
8. SOTHIS MEANS...
• ... we have to focus more on communication
• ... leave no room for misinterpretation
• ... we have to work together with the client
• ... we got to have a system
• ... we have to validate regularly if what we have built is still
according to acceptance criteria
Saturday, May 18, 13
9. SOTHIS MEANS...
• ... we have to focus more on communication
• ... leave no room for misinterpretation
• ... we have to work together with the client
• ... we got to have a system
• ... we have to validate regularly if what we have built is still
according to acceptance criteria
Automation?
Saturday, May 18, 13
16. WRITING REQUIREMENTS
• Describe how a problem will be solved
• Write them together with your client
• In the (technical) language of the client
• Try to describe the functional problem, not the technical one
Saturday, May 18, 13
18. FEATURE FILE LAYOUT
Feature: {feature description}
{intention}
As a {person}
I want {feature}
So that {intention}
Scenario: {specific scenario description}
Given {context}
And {more context}
When {action}
Then {result}
Scenario: ...
Information: http://dannorth.net/whats-in-a-story/
Saturday, May 18, 13
19. EXAMPLE FEATURE
Feature: Searching on the internet
As a google.com visitor
I want to use the search engine
So that i can find information on the internet
Scenario: Simple keyword search
Given I am on the homepage
When I fill in the search term “PHP”
And I press “Google search”
Then I should see search results containing “PHP”
Scenario: I feel lucky
Given I am on the homepage
When I fill in the search term “PHP”
And I press “I’m feeling lucky”
Then I should not be on google.com
And I should see “PHP”
Saturday, May 18, 13
20. STEPS? (TERMINOLOGY)
Feature: {feature description}
{intention}
As a {person}
I want {feature}
So that {intention}
Scenario: {specific scenario description}
Given {context}
And {more context}
When {action}
Then {result}
Scenario: ...
Saturday, May 18, 13
21. STEPS? (TERMINOLOGY)
Feature: {feature description}
{intention}
As a {person}
I want {feature}
So that {intention}
Scenario: {specific scenario description}
Given {context}
And {more context}
When {action}
Then {result}
Scenario: ...
Feature, user story, module
Saturday, May 18, 13
22. STEPS? (TERMINOLOGY)
Feature: {feature description}
{intention}
As a {person}
I want {feature}
So that {intention}
Scenario: {specific scenario description}
Given {context}
And {more context}
When {action}
Then {result}
Scenario: ...
Feature, user story, module
Scenario
Saturday, May 18, 13
23. STEPS? (TERMINOLOGY)
Feature: {feature description}
{intention}
As a {person}
I want {feature}
So that {intention}
Scenario: {specific scenario description}
Given {context}
And {more context}
When {action}
Then {result}
Scenario: ...
Feature, user story, module
Scenario
Steps
Saturday, May 18, 13
24. LIVING DOCUMENTATION
• All features and scenarios make great documentation!
• A change request starts with rewriting documentation
• Easy to see what functionality the application contains
• Easy to get a feel for the impact of a change
• Easy to get a new team member involved
Saturday, May 18, 13
32. COMPONENTS OF A BEHAT+MINK
FUNCTIONALTEST SUITE
• Features
• Feature parser
• Generic browser controller client
• Browser controller/simulator
• Executable code that controls the browser controller client
Saturday, May 18, 13
33. COMPONENTS OF A BEHAT+MINK
FUNCTIONALTEST SUITE
• Features
• Feature parser
• Generic browser controller client
• Browser controller/simulator
• Executable code that controls the browser controller client
Living documentation
Saturday, May 18, 13
34. COMPONENTS OF A BEHAT+MINK
FUNCTIONALTEST SUITE
• Features
• Feature parser
• Generic browser controller client
• Browser controller/simulator
• Executable code that controls the browser controller client
Living documentation
Behat
Saturday, May 18, 13
35. COMPONENTS OF A BEHAT+MINK
FUNCTIONALTEST SUITE
• Features
• Feature parser
• Generic browser controller client
• Browser controller/simulator
• Executable code that controls the browser controller client
Living documentation
Behat
Mink
Saturday, May 18, 13
36. COMPONENTS OF A BEHAT+MINK
FUNCTIONALTEST SUITE
• Features
• Feature parser
• Generic browser controller client
• Browser controller/simulator
• Executable code that controls the browser controller client
Living documentation
Behat
Mink
Selenium, Zombie.js, Goutte,
etc.
Saturday, May 18, 13
37. COMPONENTS OF A BEHAT+MINK
FUNCTIONALTEST SUITE
• Features
• Feature parser
• Generic browser controller client
• Browser controller/simulator
• Executable code that controls the browser controller client
Living documentation
Behat
Mink
Selenium, Zombie.js, Goutte,
etc.
MinkExtension
Saturday, May 18, 13
40. HELLO BEHAT
1. Initialize a Behat testsuite skeleton
$ bin/behat --init
2. Behat creates it’s standard project structure
Saturday, May 18, 13
41. MINKEXTENSION
1. Bridges the gap between Behat and Mink
2. Contains a set of predefined step definitions
3. Not all step definitions may be usable for all projects
4. Behat + Mink is easy:
use BehatMinkExtensionContextMinkContext;
class FeatureContext extends MinkContext
{
// ...
}
features/FeatureContext.php
Saturday, May 18, 13
42. MINKEXTENSION STEPS
Given /^(?:|I )am on (?:|the )homepage$/
When /^(?:|I )go to (?:|the )homepage$/
Given /^(?:|I )am on "(?P<page>[^"]+)"$/
When /^(?:|I )fill in "(?P<field>(?:[^"]|")*)" with "(?P<value>(?:[^"]|")*)"$/
When /^(?:|I )press "(?P<button>(?:[^"]|")*)"$/
When /^(?:|I )follow "(?P<link>(?:[^"]|")*)"$/
Then /^(?:|I )should be on "(?P<page>[^"]+)"$/
Then /^(?:|I )should see "(?P<text>(?:[^"]|")*)"$/
$ bin/behat -dl
/**
* Clicks link with specified id|title|alt|text.
*
* @When /^(?:|I )follow "(?P<link>(?:[^"]|")*)"$/
*/
public function clickLink($link)
{
$link = $this->fixStepArgument($link);
$this->getSession()->getPage()->clickLink($link);
}
Saturday, May 18, 13
43. BEHAT.YML
• Place for configuration options
• Basic Behat / Mink config
default:
extensions:
BehatMinkExtensionExtension:
base_url: "http://www.yourwebsite.com"
goutte: ~
selenium2: ~
Saturday, May 18, 13
45. EXAMPLE FEATURE
Feature: Search on the internet
As a google.com visitor
I want to use the search engine
So that i can find information on the internet
Scenario: Simple keyword search
Given I am on the homepage
When I fill in the search term “PHP”
And I press “Google search”
Then I should see search results containing “PHP”
features/search.feature
Saturday, May 18, 13
46. STEP DEFINITIONS
/**
* @When /^I fill in the search term "([^"]*)"$/
*/
public function iSearchTheTerm($arg1)
{
throw new PendingException();
}
Put these in your FeatureContext.php file.
$ bin/behat
Running Behat
Behat gives you step suggestions:
Saturday, May 18, 13
47. WRITING STEP DEFINITIONS
/**
* @When /^I search the term "([^"]*)"$/
*/
public function iSearchTheTerm($searchTerm)
{
$this->fillField('q', $searchTerm); // method from MinkExtension
$this->pressButton('Google search');
}
Saturday, May 18, 13
48. MINKTERMINOLOGY
• Driver = Browser controller/emulator
• Session = Browser
• Page = Document(Element)
• Element
• Selectors
• XPath
• CSS
• Named
Saturday, May 18, 13
50. PAGE/DOCUMENTTRAVERSAL
• Selection of elements on a page
• Selectors based on XPath, CSS, Names
$page = $this->getPage();
$elements = $page->findAll('xpath', './/div[@class="sa_mc"]');
$elements = $page->findAll('css', 'div[class="sa_mc"]');
Saturday, May 18, 13
51. ELEMENT ACTIONS
$page = $this->getSession()->getPage();
$loginLink = $page->find('css', '#login');
$loginLink->click();
->getValue();
->setValue();
->keyUp();
->press();
etcetera...
Saturday, May 18, 13
57. SCENARIO OUTLINES
Scenario Outline: Simple keyword search
Given I am on the homepage
When I search the term <searchterm>
Then I should see search results containing <searchterm>
Examples:
| searchterm |
| PHP |
| Java |
| Pie |
| This string is possibly too long and uncommon |
Saturday, May 18, 13
62. LOCALIZATION
• Write features in your own language
# language: it
Funzionalità: non so scrivere italiano
Scenario: ...
Dato ...
Quando ...
Allora ...
Schema dello scenario: ...
Dato ...
Quando ...
Allora ...
Esempi:
...
Saturday, May 18, 13
63. INTEGRATION WITH JENKINS
• Behat includes export to jUnit format
• Jenkins build step example
${WORKSPACE}/bin/behat --format junit --out ${WORKSPACE}/build
Saturday, May 18, 13
64. CONCLUSION
1. Writing examples is great to improve communication
2. Automating acceptance criteria = consistent quality
3. Behat and Mink are an excellent combination to do this
Saturday, May 18, 13