HTTPUNIT. What is HTTPUNIT HttpUnit is an open source software testing framework used to perform testing of web sites without the need for a web browser.

Slides:



Advertisements
Similar presentations
MWD1001 Website Production Using JavaScript with Forms.
Advertisements

JLab Lattice Portal – Data Grid Web Service Ying Chen, Chip Watson Thomas Jefferson National Accelerator Facility.
Testing Web Applications. Applications Architecture Client Server Architecture.
MAHDI OMAR JUNIT TUTORIAL. CONTENTS Installation of Junit Eclipse support for Junit Using Junit exercise JUnit options Questions Links and Literature.
Testing Object Oriented Programs CSE 111 4/28/20151.
Pubman and Selenium tests. What is Selenium Selenium is a suite of Web application test automation tools for any browser on any operating system –Firefox,
Fundamentals, Design, and Implementation, 9/e Chapter 14 JDBC, Java Server Pages, and MySQL.
Servlets and a little bit of Web Services Russell Beale.
Development of a Web Based B&B Reservation System Elizabeth Gates 22July04.
1 Static Web Pages Websites on Servers (The Big Picture) –Apache Tomcat can support static web pages –Primarily intended to support servlets and JSP –Some.
Creating your website Using Plain HTML. What is HTML? ► Web pages are authored in HyperText Markup Language (HTML) ► Plain text is marked up with tags,
Direct Congress Dan Skorupski Dan Vingo. Inner workings Reminder: MVC design pattern Procedural view: From request to response o Request passed to a view.
Chapter 4 Servlets Concept of Servlets (What, Why, and How) Servlet API Third-party tools to run servlets Examples of Using Servlets HTML tag with GET.
Selenium – Testing Tool. What is Selenium? Selenium is a robust set of tools that supports rapid development of test automation for web-based applications.
Quick Tour of the Web Technologies: The BIG picture LECTURE A bird’s eye view of the different web technologies that we shall explore and study.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Introductory Meeting. Why are we here? RIP FrontPage Versions prior to 2003 will not work with Windows7 No longer supported by Microsoft You can still.
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.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
Confidential 9/13/2015 Slide 1. FitNesse + WATIJ = WitNesse (Or is it FATIJ) Paul Lamb Vik Anantha.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
Advanced Web Design Scripting Tutorial Chapters. Scripting Intro The scripting part of the forthcoming Advanced Web Design textbook introduces you to.
Testing Web applications. Selenium What is Selenium? Selenium is a suite of tools to automate web application testing across many platforms Tests run.
WEB DESIGN USING DREAMWEAVER. The World Wide Web –A Web site is a group of related files organized around a common topic –A Web page is a single file.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
1 HTTPUNIT Lauri Peterson Technology Partners, Inc
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
Standalone Java Application vs. Java Web Application
Chapter 5 HTTP Request Headers. Content 1.Request headers 2.Reading Request Headers 3.Making a Table of All Request Headers 4.Sending Compressed Web Pages.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2011.
Lecture 8 – Cookies & Sessions SFDV3011 – Advanced Web Development 1.
Chapter 6 Server-side Programming: Java Servlets
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
Testing Web Applications. Plan The presentation covers: Selenium framework Spring MVC Test framework HttpUnit framework.
Pubman and Selenium tests. What is Selenium Selenium is a suite of Web application test automation tools for any browser on any operating system –Firefox,
Automated Smoke Testing on the JVM with Geb João SILVA (GS-AIS-EB) 1st Forum 29th of September, 2015 e-Business Section AUTOMATED SMOKE.
Jsp (Java Server Page) Is a server side program.
INTRODUCTION TO WEB APPLICATION Chapter 1. In this chapter, you will learn about:  The evolution of the Internet  The beginning of the World Wide Web,
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
Implementing and Using the SIRWEB Interface Setup of the CGI script and web procfile Connecting to your database using HTML Retrieving data using the CGI.
Compliance Test Language (CTL) Chuck Morris Northrop Grumman.
Forms Overview, Query string, Submitting arrays, PHP & HTML, Input types, Redirecting the user Mario Peshev Technical Trainer Software.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Security Issues With Web Based Systems. Security Issues Web Based Systems  Security can not be considered an add-on or afterthought  Security must be.
Vakgroep Informatietechnologie – Onderzoeksgroep (naam) Web Centric Design of Distributed Software.
1 State and Session Management HTTP is a stateless protocol – it has no memory of prior connections and cannot distinguish one request from another. The.
© Copyright 2009 SSLPost 01. © Copyright 2009 SSLPost 02 a recipient is sent an encrypted that contains data specific to that recipient the data.
AJAX Use Cases for WSRP Subbu Allamaraju BEA Systems Inc WSRP F2F Meeting, May 2006.
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.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
Introduction. Internet Worldwide collection of computers and computer networks that link people to businesses, governmental agencies, educational institutions,
Web Services Essentials. What is a web service? web service: software functionality that can be invoked through the internet using common protocols like.
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
Arklio Studija 2007 File: / / Page 1 Automated web application testing using Selenium
Subbu Allamaraju BEA Systems Inc
Software Development Tools
PHP / MySQL Introduction
Web Systems Development (CSC-215)
The Application Lifecycle
Web Systems Development (CSC-215)
Back end Development CS Programming Languages for Web Applications
An Introduction to JavaScript
Client-Server Model: Requesting a Web Page
Lecture 34: Testing II April 24, 2017 Selenium testing script 7/7/2019
Back end Development CS Programming Languages for Web Applications
Software Development Tools
Presentation transcript:

HTTPUNIT

What is HTTPUNIT HttpUnit is an open source software testing framework used to perform testing of web sites without the need for a web browser. HttpUnit is an open source software testing framework used to perform testing of web sites without the need for a web browser. HttpUnit is primarily designed for "black-box" testing of web sites HttpUnit is primarily designed for "black-box" testing of web sites HttpUnit is free software available from [HttpUnitSite] that implements several useful unit testing methods together with classes for connecting to HTTP servers, processing HTML, and maintaining stateful sessions. HttpUnit is free software available from [HttpUnitSite] that implements several useful unit testing methods together with classes for connecting to HTTP servers, processing HTML, and maintaining stateful sessions.

BSD(Berkeley Software Distribution) license. BSD(Berkeley Software Distribution) license. Recent Version HttpUnit1.7 Recent Version HttpUnit1.7 JavaScript support is very basic at present. The near-term goal is full JavaScript 1.1 support. Currently, we do not plan to support browser-specific JavaScript. JavaScript support is very basic at present. The near-term goal is full JavaScript 1.1 support. Currently, we do not plan to support browser-specific JavaScript.

HttpUnit supports : o HTML form submission HTML o JavaScript JavaScript o automatic page redirection and cookies. cookies o Written in Java, HttpUnit allows Java test code to process returned pages as text, XML DOM, or containers of forms, tables and links JavaDOMJavaDOM

It is well suited to be used in combination with JUnit. It is well suited to be used in combination with JUnit.JUnit It easily write tests that verify the proper behaviour of a web site. It easily write tests that verify the proper behaviour of a web site. The use of HttpUnit allows for automated testing of web applications The use of HttpUnit allows for automated testing of web applications

The center of HttpUnit is the WebConversation class, which takes the place of a browser talking to a single site. The center of HttpUnit is the WebConversation class, which takes the place of a browser talking to a single site.WebConversation It is responsible for maintaining session context, which it does via cookies returned by the server. It is responsible for maintaining session context, which it does via cookies returned by the server. To use it, one must create a request and ask the WebConversation for a response. To use it, one must create a request and ask the WebConversation for a response.request For Example: WebConversation wc = new WebConversation(); WebRequest req = new GetMethodWebRequest( " ); WebResponse resp = wc.getResponse( req );

The response may now be manipulated either as pure text (via the getText() method), as a DOM (via the getDOM() method) The response may now be manipulated either as pure text (via the getText() method), as a DOM (via the getDOM() method)response WebConversation wc = new WebConversation(); WebResponse resp = wc.getResponse( " ); WebConversation wc = new WebConversation(); WebResponse resp = wc.getResponse( " );

Some Drawbacks to HTTPUnit: Tests are tied to page structures. Tests are tied to page structures. If you change your page (say, reordering links or forms), you will break your tests. If you change your page (say, reordering links or forms), you will break your tests. Test assertions typically depend on the content of the page. Test assertions typically depend on the content of the page. If content changes, tests may break. If content changes, tests may break. Checking content is not completely sufficient for testing Grid portals. Checking content is not completely sufficient for testing Grid portals.

public WebConversation loginToPortal() throws Exception { //WebConversation objects are the cornerstone class. //WebConversation objects are the cornerstone class. WebConversation wc = new WebConversation(); WebConversation wc = new WebConversation(); //We will need to specify the user agent to simulate a browser. //We will need to specify the user agent to simulate a browser. ClientProperties cprops = wc.getClientProperties(); ClientProperties cprops = wc.getClientProperties(); cprops.setUserAgent("Mozilla/5.0"); cprops.setUserAgent("Mozilla/5.0"); WebResponse resp = wc.getResponse(portalUrl); WebResponse resp = wc.getResponse(portalUrl); // Find the login form. // Find the login form. // It's not named so we pick it out of an array // It's not named so we pick it out of an array String frontPage = resp.getText(); String frontPage = resp.getText();

//First make sure we are looking at the right web page. assertTrue("Failed to get front page", assertTrue("Failed to get front page", frontPage.indexOf("Please Login") != -1); frontPage.indexOf("Please Login") != -1); WebForm form = resp.getForms()[1]; WebForm form = resp.getForms()[1]; assertNotNull("No login form found", form); assertNotNull("No login form found", form); // Fill in form and submit // Fill in form and submit form.setParameter("userName", “admin”); form.setParameter("userName", “admin”); form.setParameter("password", “admin”); form.setParameter("password", “admin”); form.submit(); form.submit(); // Get logged in page // Get logged in page WebResponse resp2 = wc.getCurrentPage(); WebResponse resp2 = wc.getCurrentPage(); String page = resp2.getText(); String page = resp2.getText(); assertFalse("Failed to log in", assertFalse("Failed to log in", page.indexOf("Please Login") != -1); page.indexOf("Please Login") != -1); return wc; return wc; }

Assertion Statement Reference: There is the list of the different types of assertion statements that are used to test your code. Assertion Statement Reference: There is the list of the different types of assertion statements that are used to test your code. o assertNotNull("url: ", url, response) o assertFalse(message, condition) o assertNotNull(object) o assertNotSame(expected, actual) o assertNotSame(message, expected, actual) o assertNull(object) o assertNull(message, object) o assertSame(expected, actual) o assertSame(message, expected, actual) o assertTrue(condition) o assertTrue(message, condition) o fail() o fail(message)

Thank You