F UNCTIONAL T ESTS IN S YMFONY Sayed Ahmed B.Sc. Eng. in Computer Science & Engineering M. Sc. in Computer Science Exploring Computing for 14+ years

Slides:



Advertisements
Similar presentations
Other Web Application Development Technologies. PHP.
Advertisements

Video, audio, embed, iframe, HTML Form
MVC IN S YMFONY Sayed Ahmed B.Sc. Eng. in Computer Science & Engineering M. Sc. in Computer Science Exploring Computing for 14+ years
CSC 450/550 Part 6: The Application Layer Example: The World Wide Web.
The Application Layer Chapter 7. Electronic Mail Architecture and Services The User Agent Message Formats Message Transfer Final Delivery.
1 The World Wide Web Architectural Overview Static Web Documents Dynamic Web Documents HTTP – The HyperText Transfer Protocol Performance Enhancements.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Creating Databases applications for the Web Reprise. Basic HTML review, forms Preview: Server side vs client side Classwork: create HTML forms and check.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Chapter 9 Using Perl for CGI Programming. Computation is required to support sophisticated web applications Computation can be done by the server or the.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
S YMFONY ORM - D OCTRINE Sayed Ahmed B.Sc. Eng. in Computer Science & Engineering M. Sc. in Computer Science Exploring Computing for 14+ years
Cookies Set a cookie – setcookie() Extract data from a cookie - $_COOKIE Augment user authentication script with a cookie.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
Server-side Scripting Powering the webs favourite services.
SIMPLE ROUTER The slide made by Salim Malakouti. Next we will create the Router  What do I we mean by a router?  Routers work similar to a map. It receives.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
1 rfXcel Confidential Copyright 2007 Web Technology JavaScript 12/10/07.
CSE 154 LECTURE 12: COOKIES. Including files: include include("filename"); PHP include("header.html"); include("shared-code.php"); PHP inserts the entire.
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
USING PERL FOR CGI PROGRAMMING
Chapter 6 Generating Form Letters, Mailing Labels, and a Directory
XP New Perspectives on The Internet, Sixth Edition— Comprehensive Tutorial 1 1 Browser Basics Introduction to the Web and Web Browser Software Tutorial.
Tracing 1www.tech.findforinfo.com. Contents Why Tracing Why Tracing Tracing in ASP.NET Tracing in ASP.NET Page Level tracing Page Level tracing Application.
JavaScript – Quiz #9 Lecture Code:
12/3/2012ISC329 Isabelle Bichindaritz1 PHP and MySQL Advanced Features.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Lecture 11 Rails Topics SaaSSaaS Readings: SaaS book Ch February CSCE 740 Software Engineering.
1 Maryland ColdFusion User Group Session Management December 2001 Michael Schuler
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
Where does PHP code get executed?. Where does JavaScript get executed?
Web Database Programming Week 7 Session Management & Authentication.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
The Module Road Map Assignment 1 Road Map We will look at… Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX.
1 Presentation Title Test-driven development (TDD) Overview David Wu.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
CSC 2720 Building Web Applications Basic Frameworks for Building Dynamic Web Sites / Web Applications.
8 th Semester, Batch 2008 Department of Computer Science SSUET.
 A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests.
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring Forms, HTML5 layout.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
CGS 3066: Web Programming and Design Spring 2016 PHP.
Microsoft Expression Web - Illustrated Unit A: Getting Started With Microsoft Expression Web.
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
National College of Science & Information Technology.
Introduction of Selenium Eli Lu 2016/10/13. Outline What is selenium ? Selenium Projects Selenium Sponsors Easy to use Useful Feature & Tools Useful Links.
Data Virtualization Tutorial… CORS and CIS
19.10 Using Cookies A cookie is a piece of information that’s stored by a server in a text file on a client’s computer to maintain information about.
Chapter 19 PHP Part III Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
AJAX.
Test Information Distribution Engine (TIDE)
Cookies BIS1523 – Lecture 23.
Web Systems Development (CSC-215)
Hyper Text Transfer Protocol
Presentation transcript:

F UNCTIONAL T ESTS IN S YMFONY Sayed Ahmed B.Sc. Eng. in Computer Science & Engineering M. Sc. in Computer Science Exploring Computing for 14+ years

F UNCTIONAL T ESTS to test your application from end to end from the request made by a browser to the response sent by the server To test all the layers of an application: the routing, the model the actions and the templates Facilitate to test use cases Test scenarios (application usage scenarios) Functional tests in Symfony provide a way to easily describe scenarios Each scenario can then be played automatically over and over again by simulating the experience a user has in a browser

A UTOMATED T ESTING USING S ELENIUM “ Selenium automates browsers. That's it. What you do with that power is entirely up to you. Primarily it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web- based administration tasks can (and should!) also be automated as well. ”

T HE SF B ROWSER CLASS sfBrowser provides methods that simulates navigation done in a classic browser: get() Gets a URL post() Posts to a URL call() Calls a URL (used for PUT and DELETE methods) back() Goes back one page in the history forward() Goes forward one page in the history reload() Reloads the current page click() Clicks on a link or a button select() selects a radiobutton or checkbox deselect() deselects a radiobutton or checkbox restart() Restarts the browser

T HE SF B ROWSER CLASS setHttpHeader() Sets an HTTP header setAuth() Sets the basic authentication credentials setCookie() Set a cookie removeCookie() Removes a cookie clearCookies() Clears all current cookies followRedirect() Follows a redirect

SOME USAGE EXAMPLES OF THE SF B ROWSER METHODS

T HE SF T EST F UNCTIONAL CLASS all tasks that generate a module automatically create a basic functional test file:

T HE ABOVE CODE IS EQUIVALENT TO ( USES : SF T EST F UNCTIONAL ):

T HE R EQUEST T ESTER ( WITH (' REQUEST ')-> BEGIN ) isParameter() Checks a request parameter value isFormat() Checks the format of a request isMethod() Checks the method hasCookie() Checks whether the request has a cookie with the given name isCookie() Checks the value of a cookie

T HE R ESPONSE T ESTER checkElement() Checks if a response CSS selector match some criteria checkForm() Checks an sfForm form object debug() Prints the response output to ease debug matches() Tests a response against a regexp isHeader() Checks the value of a header isStatusCode() Checks the response status code isRedirected() Checks if the current response is a redirect isValid() Checks if a response is well-formed XML (you also validate the response again its document type be passing true as an argument)

R UNNING F UNCTIONAL T ESTS Execute the test file $ php test/functional/frontend/categoryActionsTest.php Use the test:functional Task $ php symfony test:functional frontend categoryActions

T EST D ATA include(dirname(__FILE__).'/../../bootstrap/functio nal.php'); $browser = new sfTestFunctional(new sfBrowser()); Doctrine_Core::loadData(sfConfig::get('sf_test_dir ').'/fixtures');

W RITING F UNCTIONAL T ESTS Writing functional tests is like playing a scenario in a browser

D EBUGGING F UNCTIONAL T ESTS $browser->with('response')->debug(); symfony provides the ~debug|Debug~() method to output the response header and content:

F UNCTIONAL T ESTS H ARNESS The test:functional task can also be used to launch all functional tests for an application: $ php symfony test:functional frontend

T ESTS H ARNESS there is also a task to launch all tests for a project (unit and functional): $ php symfony test:all

R EFERENCES