This document provides instructions for setting up acceptance and integration testing using Behat. It discusses copying code into a virtual host, uncommenting a line in a PHP file, and installing Sahi. It also provides commands for running Behat tests with different tags.
OSDC 2011 | Advanced Puppet Topics by Ken BarberNETWAYS
Viele User kennen Puppet wahrscheinlich schon aus Ihrem täglichen Arbeitsleben haben aber wahrscheinlich nicht die Zeit es bis auf seine Grenzen auszutesten was dessen Funktionalität betrifft. Dieser Vortrag bietet einen Einblick über Features für fortgeschrittene Anwender mit folgenden Themen, welche durch praktische Beispiele ergänzt werden:
Unterstützung vom neuen Ruby DSL zum Schreiben von Manifesten im reinen Ruby
Die extlookup Funktion zum Speichern von Informationen in externen Formaten
Benutzung von dotty output zur Analyse von Ressourcen - Abhängigkeiten
Exportierte Ressourcen-Abhängigkeiten als Zugang zu generierten Informationen anderer nodes
Externe node classifiers um Puppet in ein externes Tool wie CMDB zu integrieren
Puppetdoc - Generierung und Handhabung zur Dokumentation von Puppet-Inhalten
Presentation about front end performance improvements with specific hints if you're running Ruby on Rails. Original presentation at the Boston-rb group in April 12, 2011
Presentation on how Puppet has been introduced in Seat Pagine Gialle to automate system administration tasks and easy the cooperation between Ops and Others.
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Robert Nelson
Let's describe the process for upgrading from Puppet 3 to 4, list some common pitfalls and how to avoid them, and be sure to enjoy ourselves in the process!
OSDC 2011 | Advanced Puppet Topics by Ken BarberNETWAYS
Viele User kennen Puppet wahrscheinlich schon aus Ihrem täglichen Arbeitsleben haben aber wahrscheinlich nicht die Zeit es bis auf seine Grenzen auszutesten was dessen Funktionalität betrifft. Dieser Vortrag bietet einen Einblick über Features für fortgeschrittene Anwender mit folgenden Themen, welche durch praktische Beispiele ergänzt werden:
Unterstützung vom neuen Ruby DSL zum Schreiben von Manifesten im reinen Ruby
Die extlookup Funktion zum Speichern von Informationen in externen Formaten
Benutzung von dotty output zur Analyse von Ressourcen - Abhängigkeiten
Exportierte Ressourcen-Abhängigkeiten als Zugang zu generierten Informationen anderer nodes
Externe node classifiers um Puppet in ein externes Tool wie CMDB zu integrieren
Puppetdoc - Generierung und Handhabung zur Dokumentation von Puppet-Inhalten
Presentation about front end performance improvements with specific hints if you're running Ruby on Rails. Original presentation at the Boston-rb group in April 12, 2011
Presentation on how Puppet has been introduced in Seat Pagine Gialle to automate system administration tasks and easy the cooperation between Ops and Others.
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Robert Nelson
Let's describe the process for upgrading from Puppet 3 to 4, list some common pitfalls and how to avoid them, and be sure to enjoy ourselves in the process!
Puppi is a Puppet modules that drives Puppet's knowledge of the Systems to a command line tool that you can use to check services availability, gather info on the system and deploy application with a single command.
Watch along with the video at https://www.youtube.com/watch?v=_oP1pFsOyDw
Oliver Hookins on "A Puppet Approach to Application Deployment and Automation in Nokia" at PuppetCamp Europe '11. Learn more: http://www.puppetlabs.com
Amsterdam, Netherlands, 2011.
Puppet Labs
Esoft Metro Campus - Diploma in Web Engineering - (Module VIII) Multimedia Technologies
(Template - Virtusa Corporate)
Contents:
include and require Statements
include and require
include_once Statement
Validating Files
file_exists() function
is_dir() function
is_readable() function
is_writable() function
is_executable() function
filesize() function
filemtime() function
filectime() function
fileatime() function
Creating and deleting files
touch() function
unlink() function
File reading, writing and appending
Open File - fopen()
Close File - fclose()
Read File - fread()
Read Single Line - fgets()
Check End-Of-File - feof()
Read Single Character - fgetc()
Seek File - fseek()
Write File - fwrite()
Write File - fputs()
Lock File - flock()
Working with Directories
Create directory - mkdir()
Remove directory - rmdir()
Open directory - opendir()
Read directory - readdir()
Forward Swift 2017: Media Frameworks and Swift: This Is FineChris Adamson
Swift is great for writing iOS and Mac apps, and its creators also mean for it to be used as a systems programming language. However, certain traits about Swift make it officially off-limits for use in some audio/video-processing scenarios. What's the deal, is it not fast enough or what? We'll look at what media apps can and can't do in Swift, and what you're supposed to do instead. We'll also look at strategies for knowing what responsibilities to dole out to Swift and to C, and how to make those parts of your code play nicely with each other.
I put on my mink and wizard behat (tutorial)xsist10
An indepth dive into using Behat/Mink/Selenium for BDD testing.
* http://behat.org
* http://mink.behat.org/
* http://docs.seleniumhq.org/
In this talk I'll cover:
* why and when to use Behat (and when not)
* Installation and configuration of Behat and Mink
* Building Behat Contexts
* Avoiding data deadlocks and "test user account" syndrome
* Introduction to Selenium and testing JavaScript
* Best practises for writing tests (what to avoid, what to aspire for, writing stories like you mean it, how to get your product owners to write them)
* Common gotchas
How to support acceptance testing of web applications with the PHP tool Behat in a BDD manner.
Including an overview of acceptance testing in agile software development in general.
Concluding with the most frequent challenges of using Behat and similar tools in practice.
Puppi is a Puppet modules that drives Puppet's knowledge of the Systems to a command line tool that you can use to check services availability, gather info on the system and deploy application with a single command.
Watch along with the video at https://www.youtube.com/watch?v=_oP1pFsOyDw
Oliver Hookins on "A Puppet Approach to Application Deployment and Automation in Nokia" at PuppetCamp Europe '11. Learn more: http://www.puppetlabs.com
Amsterdam, Netherlands, 2011.
Puppet Labs
Esoft Metro Campus - Diploma in Web Engineering - (Module VIII) Multimedia Technologies
(Template - Virtusa Corporate)
Contents:
include and require Statements
include and require
include_once Statement
Validating Files
file_exists() function
is_dir() function
is_readable() function
is_writable() function
is_executable() function
filesize() function
filemtime() function
filectime() function
fileatime() function
Creating and deleting files
touch() function
unlink() function
File reading, writing and appending
Open File - fopen()
Close File - fclose()
Read File - fread()
Read Single Line - fgets()
Check End-Of-File - feof()
Read Single Character - fgetc()
Seek File - fseek()
Write File - fwrite()
Write File - fputs()
Lock File - flock()
Working with Directories
Create directory - mkdir()
Remove directory - rmdir()
Open directory - opendir()
Read directory - readdir()
Forward Swift 2017: Media Frameworks and Swift: This Is FineChris Adamson
Swift is great for writing iOS and Mac apps, and its creators also mean for it to be used as a systems programming language. However, certain traits about Swift make it officially off-limits for use in some audio/video-processing scenarios. What's the deal, is it not fast enough or what? We'll look at what media apps can and can't do in Swift, and what you're supposed to do instead. We'll also look at strategies for knowing what responsibilities to dole out to Swift and to C, and how to make those parts of your code play nicely with each other.
I put on my mink and wizard behat (tutorial)xsist10
An indepth dive into using Behat/Mink/Selenium for BDD testing.
* http://behat.org
* http://mink.behat.org/
* http://docs.seleniumhq.org/
In this talk I'll cover:
* why and when to use Behat (and when not)
* Installation and configuration of Behat and Mink
* Building Behat Contexts
* Avoiding data deadlocks and "test user account" syndrome
* Introduction to Selenium and testing JavaScript
* Best practises for writing tests (what to avoid, what to aspire for, writing stories like you mean it, how to get your product owners to write them)
* Common gotchas
How to support acceptance testing of web applications with the PHP tool Behat in a BDD manner.
Including an overview of acceptance testing in agile software development in general.
Concluding with the most frequent challenges of using Behat and similar tools in practice.
Many services / applications now a day are ill equipped with handling a sudden rush of popularity, as is often the case on the internet now a days, to a point where the services either become unavailable or unbearably slow.
By taking a chapter from the ant colonies in the wild, where their strength lies in their numbers and the fact that everyone works together towards the same goal, we can apply the same principle to our
service by using systems such as:
- gearman
- memcache
- daemons
- message queues
- load balancers
and many more, you can achieve greater performance, more redundancy, higher availability and have the ability to scale your services up and down as required easily.
During this talk attendees will be lead through the world of distributed systems and scalability, and shown the how, where and what, of how to take the average application and splitting it into smaller more manageable pieces.
View a recording of this presentation at http://www.acquia.com/resources/acquia-tv/conference/biggest-increase-your-drupal-productivity-how-install-use-and
Batou ist ein Open-Source Werkzeug um mit Python das Deployment von komplexen Anwendungen zu beschreiben und zu automatisieren.
Das Konzept besteht darin eine passende allgemeine Modellsprache in Form einer API zu definieren. Dabei stehen Wiederverwendung, Toleranz gegenüber unbekannten Zuständen und Ausdrucksstärke im Vordergrund.
Der Vortrag zeigt den Werdegang und unsere Motivation zur Entwicklung von batou auf und zeigt die konzeptionellen Stärken anhand praktischer Beispiele.
Wir haben in den letzten Jahren eine Reihe großer und kleiner Projekte beim Deployment betreut.
Im Rahmen unserer Plattform "gocept.net" bereiten wir unsere Erfahrungen in Dokumentation und offenen Werkzeugen auf und haben daher batou entwickelt.
batou ist sowohl in Python geschrieben und nutzt Python um Deployment-Strukturen zu beschreiben.
Wir möchten Batou gerne vorstellen um unsere Erfahrungen weiterzugeben und (auch auf den Sprints) anzuregen sich mit dem Werkzeug auseinanderzusetzen, Feedback zu bekommen, und daran weiterzuarbeiten.
Siehe auch: http://bitbucket.org/gocept/batou
Ext GWT provides a solid foundation to build rich internet applications. In this session, you will learn the best practices used to build these applications. Topics include how to use HTML templates and HtmlLayout, MVC / MVP, RPC, and managing data.
DPC 2016 - 53 Minutes or Less - Architecting For Failurebenwaine
An increasing amount of web and business applications are hosted on the cloud. It’s easy: a few clicks, api calls or a script written with your favourite IaaS provider and your application is launched and available to your consumers.
That’s the problem, it’s deceptively easy to make an application available. It’s much harder to make an application reliably available. The much touted “four nines” - 99.99% availability means your application must be consistently available for all but 53 minutes a year.
Using AWS as an example this talk covers the choices you must make when hosting an application from the network up. Choices around Regions, Availability Zones, Service Discovery, Deployment and Maintenance all have a major impact on up time.
The practice of “Chaos Engineering” made famous by Netflix is demonstrated as a way to validate the choices you’ve made and help prepare you for the worst.
You’re a Senior Developer, providing value through producing great code, planning features and by mentoring junior team members. You may be considering how to progress your career - if you want to stay technical rather than move into management then the role of Technical Team Lead is worth considering.
The technical team lead is responsible for the technical leadership of one or more teams. Typical responsibilities include:
- Coding: importantly, Technical Team Leads still spend a large portion of their time “in the code”
- High level planning of product architecture and features
- Making or adjudicating technical decisions that affect the whole project or team
- Taking care of your team (socially, managing growth and through learning and development)
This talk covers what a day in the life of a Tech Lead is like, which skills you should develop and which opportunities within your business to pursue to help you reach your goals. I’ll use examples from my own experience and that of fellow leads to help you make the progression to the Lead role.
The slides from my talk at PHPUK2015.
The comapniuon code can be found at: https://github.com/LoveSoftware/application-logging-with-logstash
If you saw it, please rate it!
https://joind.in/talk/view/13369
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
4. Set Up
For instant set up:
1) Copy code into a new vhost with the web root
pointing at the ‘public’ folder.
2) Uncomment line 13 in:
tests/acceptance/features/bootstrap/UIContext.php
3) Install Sahi from the misc folder.
Saturday, 29 October 11
5. Set Up
Goto: tests/acceptance/
If setting up today run the Behat command using
behat.phar
eg: php behat.phar --tags demo1
If you have previously set up, run the
behat command
eg: behat --tags demo1
Saturday, 29 October 11
6. Me
Software Engineer
PHP Developer
Sky Bet
PHP / MySQL Stack
PHPUnit / Selenium / Behat
Saturday, 29 October 11
7. Roadmap
•Intro To Behaviour Driven Development
•Introducing Behat
•Gherkin & Steps
•API / Service Layer Testing
•UI Testing
•Phabric - Dynamic Fixture Creation
Saturday, 29 October 11
8. joind.in
http://joind.in/talk/view/4328
Saturday, 29 October 11
21. Feature Files
Feature: Home Page
When visiting the PHPCon site
As a site visitor
I need to be able to see what
` conferences are coming up
Saturday, 29 October 11
Name of test
Description of test
22. Scenarios
Scenario: Get all conferences
Given there is conference data in the database
When I go to the homepage
Then I should see three conferences in a table
Saturday, 29 October 11
Scenario.
Multiple scenarios in a single feature file
23. Scenarios
Given
(Some Context)
When
(Some Event)
Then
(The Outcome)
Saturday, 29 October 11
Keywords.
Always follow the same formula
24. Given
(Some Context)
Given there is conference data in the database
Saturday, 29 October 11
Sets up some state or context
25. When
(Some Event)
When I go to the homepage
When I use the findConferences method
When I am on "/index.php"
When I fill in "search-text" with "PHP"
Saturday, 29 October 11
Executes whatever it is your testing.
A http call, a method invocation, a page load
26. Then
(The Outcome)
Then I should see three conferences in a table
Then I should get a array of three conferences
Then I should see "PHPNW"
Saturday, 29 October 11
An assertion.
Has it worked?
Are we seeing what we expect to see.
27. ConferenceService.feature
Feature: ConferenceService Class
In order to display conferences on
PHPCon site
As a developer
I need to be able to retrieve conferences
Scenario: Get all conferences
Given there is conference data in the database
When I use the findConferences method
Then I should get a array of three conferences
AND it should contain the conference “PHPNW”
Saturday, 29 October 11
Written By our TESTERS - Fed In From BAs
How is this feature executed?
Each step is reusable!
MENTION PHP METHODS + ANNOTATIONS!!!!
28. Class Methods & Annotations
Saturday, 29 October 11
Written By our TESTERS - Fed In From BAs
How is this feature executed?
Each step is reusable!
MENTION PHP METHODS + ANNOTATIONS!!!!
29. / Everybody Stand Back /
Behat Knows Regular Expressions
Saturday, 29 October 11
PHP Annotations used to map steps to lines
Behat supplies regex.
30. Demo One
Behat’s - Regex Fu
Saturday, 29 October 11
35. Fill in the Feature Context File
public function __construct(array $parameters)
{
$params = array(
'user' => $parameters['database']['username'],
'password' => $parameters['database']['password'],
'driver' => $parameters['database']['driver'],
'path' => $parameters['database']['dbPath'],
);
$con = DoctrineDBALDriverManager::getConnection($params);
$confMapper = new PHPConConferenceMapper($con);
$confService = new PHPConConferenceService($confMapper);
$this->service = $confService;
}
Saturday, 29 October 11
The Feature context file
- Ever feature gets a instance. Set up some
resources.
- Set up the object to test - similar to PHPUnit’s set
up method.
36. Fill in the Feature Context File
/**
* @Given /^there is conference data in the database$/
*/
public function thereIsConferneceDataInTheDatabase()
{
$fileName = self::$dataDir .
'sample-conf-session-data.sql';
self::executeQueriesInFile($fileName);
}
Saturday, 29 October 11
Remember - Given sets the state.
Loads an sql fixture to the DB.
37. Fill in the Feature Context File
/**
* @When /^I use the findConferences method$/
*/
public function iUseTheFindConferencesMethod()
{
$this->result = $this->service->findConferences();
}
Saturday, 29 October 11
Remember - When executes the thing you want to
test.
38. Fill in the Feature Context File
/**
*@Then /^I should get an array of (d+) conferences$/
*/
public function iShouldGetAnArrayOfConferences
($numberOfCons)
{
assertInternalType('array', $this->result);
assertEquals($numberOfCons, count($this->result));
}
Saturday, 29 October 11
Remember - This verifies the output
Also - identified a number. Passes the number into
the method.
39. /**
* @Then /^it should contain the
* conference "([^"]*)"$/
*/
public function itShouldContainTheConference
($confName)
{
$names = array();
foreach($this->result as $conf)
{
$names[$conf->getName()] = true;
}
if(!array_key_exists($confName, $names))
{
throw new Exception("Conference "
. $confName . " not found");
}
}
Saturday, 29 October 11
46. What about the UI?
Saturday, 29 October 11
We’ve covered testing a service class. But how do you test the UI?
47. Mink
Saturday, 29 October 11
Part of the Behat Project.
A abstraction over a number of different browser testing tools.
48. Mink
Goutte Sahi
Zombie.js
Saturday, 29 October 11
Goutte - headless browser
Sahi - like selenium
Zombie.js -
49. Extend Mink Context
Includes predefined steps
Use Bundled steps to create
higher level abstractions.
Saturday, 29 October 11
50. Back To:
My Amazing PHP Conference
Website!
Saturday, 29 October 11
We need a UI to test
introducing.....
51. Example
Using Minks Bundled Steps
Scenario: View all conferences on the homepage
Given there is conference data in the database
When I am on "/index.php"
Then I should see "PHPNW" in the ".conferences" element
And I should see "PHPUK" in the ".conferences" element
And I should see "PBC11" in the ".conferences" element
Saturday, 29 October 11
This is ok - but ties the feature to your implementation.
52. Link
FeatureContext.php
to
UIContext.php
Saturday, 29 October 11
This is ok - but ties the feature to your implementation.
53. class FeatureContext
public function __construct(array $parameters)
{
$this->useContext('subcontext_alias',
new UIContext($parameters));
! // REST OF FEATURE CONSTRUCTOR
}
# features/bootstrap/UIContext.php
use BehatBehatContextClosuredContextInterface,
BehatBehatContextBehatContext,
BehatBehatExceptionPendingException;
use BehatGherkinNodePyStringNode,
BehatGherkinNodeTableNode;
require_once 'mink/autoload.php';
class UIContext extends BehatMinkBehatContextMinkContext
{
}
Saturday, 29 October 11
1) Linking feature files
2) All steps included ‘out the box’
54. Demo Three
A Behat UI Test (Using Mink + Goutte)
Saturday, 29 October 11
This is ok - but ties the feature to your implementation.
55. Exercise Two
Testing the UI with Mink and
the headless browser Goutte.
Saturday, 29 October 11
56. Exercise Two
Open the PDF in the sources folder.
Read through Section Two.
Start Coding :)
Saturday, 29 October 11
57. Abstracting your scenario
Scenario: View all conferences on the homepage
Given there is conference data in the database
When I am on the "home" page
Then I should see "PHPNW" in the "conferences table”
And I should see "PHPUK" in the "conferences table”
And I should see "PBC11" in the "conferences table”
Saturday, 29 October 11
58. Mink Feature Context
class UIContext extends BehatMinkBehatContext
MinkContext
{
protected $pageList = array(
"home" => '/index.php');
protected $elementList = array(
"conferences table" => '.conferences');
Saturday, 29 October 11
A simple abstraction that makes a map of pages >
urls and elements > css selectors.
Example of step delegation.
Now you never change the feature file. Just steps.
59. /**
* @When /^I am on the "([^"]*)" page$/
*/
public function iAmOnThePage($pageName) {
if(!isset($this->pageList[$pageName])) {
throw new Exception(
'Page Name: not in page list');
}
$page = $this->pageList[$pageName];
return new When("I am on "$page"");
}
Saturday, 29 October 11
A simple abstraction that makes a map of pages >
urls and elements > css selectors.
Example of step delegation.
Now you never change the feature file. Just steps.
60. /**
* @Then /^I should see "([^"]*)" in the "([^"]*)"$/
*/
public function iShouldSeeInThe($text, $element) {
if(!isset($this->elementList[$element])) {
throw new Exception(
'Element: ' . $element . ‘not in element list');
}
$element = $this->elementList[$element];
return
new Then("I should see "$text" in the
"$element" element");
}
Saturday, 29 October 11
A simple abstraction that makes a map of pages >
urls and elements > css selectors.
Example of step delegation.
Now you never change the feature file. Just steps.
61. Demo Four
A Behat UI Test (Using Mink + Goutte)
UI implementation abstracted away from Gherkin.
Saturday, 29 October 11
This is ok - but ties the feature to your implementation.
62. Exercise Three
Abstracting the UI implementation away from the
Gherkin.
Saturday, 29 October 11
63. Exercise Three
Open the PDF in the sources folder.
Read through Section Three.
Start Coding :)
Saturday, 29 October 11
65. Back To:
My Amazing PHP Conference
Website!
Saturday, 29 October 11
We need a UI to test
introducing.....
66. Example
@javascript
Scenario: Use autocomplete functionality to
complete a input field
Given there is conference data in the
database
When I am on the "home" page
When I fill in "search-text" with "PHP"
And I wait for the suggestion box to appear
Then I should see "PHPNW"
Saturday, 29 October 11
Mention @tags
SO you need to test java script.
Headless browser isn’t suitable.
67. Great Reuse
@javascript
Scenario: Use autocomplete functionality to
complete a input field
Given there is conference data in the
database
When I am on the "home" page
When I fill in "search-text" with "PHP"
And I wait for the suggestion box to appear
Then I should see "PHPNW"
Saturday, 29 October 11
These are supplied by Mink. Woohoo!
REUSE
68. // In the UIContext class
/**
* @Given /^I wait for the suggestion box to appear$/
*/
public function iWaitForTheSuggestionBoxToAppear()
{
$this->getSession()->wait(5000,
"$('.suggestions-results').children().length > 0"
);
}
Saturday, 29 October 11
Get session - gets you mink
Wait,
Then execute jquery!
69. Demo Five
UI Testing With Sahi
Saturday, 29 October 11
This is ok - but ties the feature to your implementation.
76. Gherkin Tables
Scenario:
Given The following events exist
| Name | Date | Venue | Desc |
| PHPNW | 2011-10-08 09:00 | Ramada Hotel | Awesome conf! |
| PHPUK | 2012-02-27 09:00 | London Business Center | Quite good conf. |
Saturday, 29 October 11
77. Demo Five
Dynamic fixture creation with Phabric.
Saturday, 29 October 11
This is ok - but ties the feature to your implementation.
78. Case Study:
Behat at Sky Bet
Saturday, 29 October 11
Whats the problem we are solving.
Three elements of the team.
Delivering the product first time. Correctly.
79. The Problem
Saturday, 29 October 11
Whats the problem we are solving.
Three elements of the team.
Delivering the product first time. Correctly.
80. The Business
Analyst
Saturday, 29 October 11
BA / Product owner has all the knowledge
Write stories
82. The
Developer
Saturday, 29 October 11
Dev - write the code
Automate the process of testing if code meets the
requirements of a story
83. The Problem
Saturday, 29 October 11
Whats the problem we are solving.
Three elements of the team.
Delivering the product first time. Correctly.
84. BDD - Skybet Workflow
BA’s Write Stories
Testers Write Gherkin
Developers Write Steps + Code
Saturday, 29 October 11
Whats the problem we are solving.
Three elements of the team.
Delivering the product first time. Correctly.
85. BDD - Skybet Workflow
Less Defects
Fewer times through this cycle
Saturday, 29 October 11
Whats the problem we are solving.
Three elements of the team.
Delivering the product first time. Correctly.
86. The Place Of Acceptance &
Integration Tests
Saturday, 29 October 11
Whats the problem we are solving.
Three elements of the team.
Delivering the product first time. Correctly.
88. A whole world of trouble.
Saturday, 29 October 11
Takes a long time to run,
Harder to implement, when they break you have to do this again!
not as reassuring!
89. joind.in
http://joind.in/talk/view/4328
Saturday, 29 October 11