2002-12-09 UNIT Enheten för IT-stöd Testing Testing Testing Joakim Björklund Director of IT Services Division Linköpings universitet Sweden.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene.
Christian Hujer What is AceUnit? How does AceUnit work? How do I use AceUnit? © 2007 Christian Hujer.
Java Server Pages (JSP)
JSP1 Java Server Pages (JSP) Introducing JavaServer Pages TM (JSP TM ) JSP scripting elements.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
Unit and Functional Testing with JUnit and Related Tools Greg Barnes University of Washington
Java Servlet & JSP © copyright 2005 SNU OOPSLA Lab.
Approach of Unit testing with the help of JUnit Satish Mishra
JUnit. What is unit testing? A unit is the smallest testable part of an application. A unit test automatically verifies the correctness of the unit. There.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
Testing Cactus and JUnit By Bill Dudney and Jonathan Lehr Neal O’Brien 10/27/04.
JSP Java Server Pages Reference:
JMeter Workshop Friday 1 December 2006 Anthony Colebourne IT Services The University of Manchester.
Introduction to Servlet & JSP
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
Apache JMeter By Mohamed Talaat
Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Performance testing with JMeter.  100% pure Java desktop application  Designed to load test client/server software (such as a web application )  JMeter.
Testing in Extreme Programming
Unit and Functional Testing Your Flex Applications Mike Nimer Dir. Of Engineering nomee.com.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
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.
Webcommerce Computer Networks Webcommerce by Linnea Reppa Douglas Martindale Lev Shalevich.
Java Servlets. Servlets When we run small Java programs within a browser these are referred to as Applets... And when we run small Java programs within.
Distributed Java Programming Distributed Java Programming Setting up a Java Development Environment.
Introduction to JUnit 3.8 SEG 3203 Winter ‘07 Prepared By Samia Niamatullah.
Chapter 2 Web app architecture. High-level web app architecture  When a client request coming in and needs servlet to serve dynamic web content, what.
Apache JMeter By Lamiya Qasim. Apache JMeter Tool for load test functional behavior and measure performance. Questions: Does JMeter offers support for.
Servlets Part 3. Topics Session Tracking ServletToServletCommunication-Servlet Chaining ServerSideIncludes AppletToServlet.
EFinanceFactory Andriy Kurhanevych, development group manager.
Confidential Continuous Integration Framework (CIF) 5/18/2004.
Software Development COMP220/COMP285 Seb Coope Introducing Ant These slides are mainly based on “Java Development with Ant” - E. Hatcher & S.Loughran.
Java Servlets and Java Server Pages Norman White Stern School of Business.
21/12/20151 T h i s p r e s e n t a t i o n w i l l p r o b a b l y i n v o l v e a u d i e n c e d i s c u s s i o n, w h i c h w i l l c r e a t e a.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
The Template Method Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Ant / continuous integration. Turning Client Vision into Results 2 Outline presentation Introduction Ant –History –Concepts –Tasks –Examples –Extending.
Unit, Regression, and Behavioral Testing Based On: Unit Testing with JUnit and CUnit by Beth Kirby Dec 13, 2002 Jules.
Test a Little, Code a Little Colin Sharples IBM Global Services New Zealand Colin Sharples IBM Global Services New Zealand.
Java Servlets and Java Server Pages
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
Automated Testing in Sakai Testing applications and services in isolation and in context Josh Holtzman, UC Berkeley David Haines, University of Michigan.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
(1) Code Walkthrough robocode-pmj-dacruzer Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of.
1 JUnit. 2 Unit Testing with JUnit If code has no automated test case written for it to prove that it works, it must be assumed not to work. An API that.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
Introduction Servlets and JSP
Unit Testing.
Software Construction Lab 10 Unit Testing with JUnit
Netscape Application Server
Chapter 5 Remote Procedure Call
Servlet Fudamentals.
Outline SOAP and Web Services in relation to Distributed Objects
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Java Servlets.
Software Development Tools
Outline SOAP and Web Services in relation to Distributed Objects
Test-driven development (TDD)
Objectives In this lesson you will learn about: Need for servlets
Java Servlets and JSP.
Software Development Tools
Plug-In Architecture Pattern
Presentation transcript:

UNIT Enheten för IT-stöd Testing Testing Testing Joakim Björklund Director of IT Services Division Linköpings universitet Sweden

UNIT Enheten för IT-stöd Testing testing testing “You all know the need for testing, but how do you actually find time to do it? This presentation gives an outline on some of the tools you can use to perform testing of your Java application and save time while weeding out the bugs. The tools discussed include HttpUnit and Canoo.” An odyssey of open source tools for testing.

UNIT Enheten för IT-stöd Testing testing testing Before we get started: Get a good software testing book! Go a course on testing at the Computer Science department! Follow a software production model Automate all testing! Daily builds! (With testing and test reports) Documentation (JavaDocs and Wiki)

UNIT Enheten för IT-stöd Testing testing testing Design patterns Refactoring Reusability Don’t gold plate the code! Spend a moment or two on system architecture

UNIT Enheten för IT-stöd Testing Testing Testing You all know the need for testing? Or do you? When are you supposed to take the cost for testing? - During development or during system maintance? Automated testing – take the time to save time! When are your application done?!?

UNIT Enheten för IT-stöd Testing Testing Testing Testing is a bit more than: System.out.println(“This works!”); Debugger expressions Small test scripts

UNIT Enheten för IT-stöd “Testing theory” Testing can be done on several “layers” of the product being developed. Unit testing – domain/application logic Integration testing – APIs Functional testing – acceptance, top-level Performance testing – the need for speed "Regression testing" is the concept of testing that asserts that everything that worked yesterday still works today

UNIT Enheten för IT-stöd Automatic Testing In order to decrease the cost, time and hassle during the testing phase, the first thing to consider is automatic testing. ”If a program feature lacks an automated test, we assume it doesn’t work. This seems much safer than the prevailing assumption, that if a developer assures us a program feature works, then it works now and forever.” Helps regression testing (or is a prerequisite)

UNIT Enheten för IT-stöd Tools - mentioned Testing tools JUnit – unit testing Cactus – unit/integration Canoo – functional testing HTTPunit – functional testing JMeter – performance testing Other useful tools Ant – build tool Bugzilla – bug tracking tool

UNIT Enheten för IT-stöd Open Source vs Commercial As you noticed all tools in this presentation is Open Source. One of the reasons for this is that the cost for the testing tool should not be an obstacle for the testing process itself. Access to the source code…

UNIT Enheten för IT-stöd Ant Ant is a build tool that enables you to automate the build process. Ant – in java for java Build files in XML i.e. build.xml Every build file contains one project element. A project element contains target elements. Each target consists of a set of task elements. Many of the tools described in this presentation utilize Ant…

UNIT Enheten för IT-stöd Ant Example of targets: Test – run the tests Clean – Clean out the output directories Deploy – Compile the JARs, WARs etc to a exec system Publish – Output the source and binaries to any distribution site All – Perform clean, fetch, build, test, docs and deploy

UNIT Enheten för IT-stöd JUnit JUnit is a framework for writing unit tests. Test case = a related set of tests, typically every class should have a test case. Test fixture – the resources needed to run the test Test suite – a collection of related test cases.

UNIT Enheten för IT-stöd JUnit 1.Subclass junit.framework.TestCase 2.If you need fixture objects, override the setUp() method. 3.Define a number of tests that return void and whose method name begin with test (testAdd(), testPut() etc) 4.If you need to release resources that where part of the fixture, override the tearDown() method 5.If needed define a suite of tests

UNIT Enheten för IT-stöd JUnit

UNIT Enheten för IT-stöd JUnit To get xml-output from the test: JUnitreport – to generate WebPages of the result

UNIT Enheten för IT-stöd Cactus A tool for tests on servlets and other J2EE components. Cactus provides ”redirectors”, which serve as points of entry to the container. The redirectors execute test cases written for Cactus in the container and provide access to container objects (HttpServletRequest, PageContext etc) Cactus integrates with JUnit

UNIT Enheten för IT-stöd Example servlet Public class LiUServlet extends javax.servlet.http.HttpServlet { Public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { Response.setContentType(”text/html”); PrintWriter writer=response.getWriter(); Writer.println(” ”); Writer.println(”Linköpings universitet ”); }}

UNIT Enheten för IT-stöd Cactus Private LiUServlet servlet; Public void setUp() throws Exception { servlet = new LiUServlet(); servlet.init(config); } /** Test of doGet method **/ public void testDoGet() throws Exception { servlet.doGet(request, response); }

UNIT Enheten för IT-stöd Cactus Public void endDoGet(com.meterware.httpunit.WebResponse response) throws Exception { WebLink link = response.getLinkWith(” Linköpings universitet”); assertNotNull(link); System.out.println(response.getText()); org.w3c.dom.Node = response.getDOM(); }

UNIT Enheten för IT-stöd Canoo Canoo is a web application testing suite. Canoo is not restricted to only testing Java applications Uses other Open Source packages (JUnit, JTidy) Fairly easy to use, can the customer write tests?

UNIT Enheten för IT-stöd Canoo As usual a project tag Properties, esp canoo.dir

UNIT Enheten för IT-stöd Canoo The following target is needed to call canoo:

UNIT Enheten för IT-stöd Canoo Lastly the target for the testing itself Detta target ska innehålla tasken testSpec (med ett eventuellt name): In testSpec you need some config parameters:

UNIT Enheten för IT-stöd Canoo A suitable sequence of test steps

UNIT Enheten för IT-stöd Canoo Closing tags:

UNIT Enheten för IT-stöd HttpUnit HttpUnit provides a Java framework for functional testing. HttpUnit is a solid ground to build your tests on. But it might comes with the price of duplication.

UNIT Enheten för IT-stöd HttpUnit WebResponse response = converstion.getResponse( WebLink link = response.getLinkWith(” Linköpings universitet”); WebRequest request = link.getRequest(); response = conversion.getResponse(request);

UNIT Enheten för IT-stöd Performance Performance: Number of simultaneous users, size of web pages returned... “the user experience” – It is the end users experience that are key to the application performance. Locate the bottlenecks as early as possible – refactor and re-architect

UNIT Enheten för IT-stöd JMeter JMeter a 100% pure java desktop application. Test: HTTP, FTP, RDBMS… Extensible… write your own test Simulate heavy load (application, server and network) Gives instant visual feedback

UNIT Enheten för IT-stöd JMeter You must have a TestPlan A TestPlan consists of one to many ThreadGroups. A thread can be seen as a simulated user A timer is added to a ThreadGroup (Constant, gaussian random, uniform random) Controller Listener

UNIT Enheten för IT-stöd Bugzilla A bug-tracking tool, since naturally there will be bugs and there is an actual need to follow progress of the software. Consider adding bugs automatically…

UNIT Enheten för IT-stöd Bugzilla

UNIT Enheten för IT-stöd Links JUnit – Canoo – HttpUnit - Bugzilla – Ant, Cactus, JMeter -

UNIT Enheten för IT-stöd Summary Automate the testing! Testing is not rocket science Include testing from the beginning Use the web

UNIT Enheten för IT-stöd Testing Testing Testing Q & A Joakim Björklund