Testing PA165 Dec 9, 2014 Petr Adámek, Tomáš Pitner.

Slides:



Advertisements
Similar presentations
Acceptance Testing vs. Unit Testing: A Developers Perspective Owen Rogers Rob Styles
Advertisements

Unit Testing Australian Development Centre Brisbane, Australia.
SPL/2010 Test-Driven Development (TDD) 1. SPL/
Unit Testing in the OO Context(Chapter 19-Roger P)
Testing and Quality Assurance
Unit Tests DEFINITION AND OVERVIEW by Paul M. code of the damned. com.
Unit and Functional Testing with JUnit and Related Tools Greg Barnes University of Washington
Alternate Software Development Methodologies
Integration testing Satish Mishra
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Illinois Institute of Technology
Testing HCI Usability Testing. Chronological order of testing Individual program units are built and tested (white-box testing / unit testing) Units are.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Introduction to Software Testing
Software Testing & Strategies
© Company Confidentialwww.itcinfotech.com Business Case for Test Automation S.Janardhanan Chief Technology Officer ITC Infotech India Limited Business.
 ETL: Extract Transformation and Load  Term is used to describe data migration or data conversion process  ETL may be part of the business process repeated.
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Lecture 6 Software Testing and jUnit CS140 Dick Steflik.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Test Organization and Management
Model Bank Testing Accelerators “Ready-to-use” test scenarios to reduce effort, time and money.
TESTING.
Testing Web Applications Willem Visser RW334. Overview Testing Theory Testing Web Apps Tools.
© 2012 IBM Corporation Rational Insight | Back to Basis Series Chao Zhang Unit Testing.
Designing For Testability. Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration,
Software Testing Testing principles. Testing Testing involves operation of a system or application under controlled conditions & evaluating the results.
How to Test Data Acces Code or Rube Goldberg:Software Developer.
Automated GUI testing How to test an interactive application automatically?
Software Development Software Testing. Testing Definitions There are many tests going under various names. The following is a general list to get a feel.
CSE 219 Computer Science III Program Design Principles.
System Test Methods TESTTEME The Test Challenge Bottom Up Testing Strategy Integration Test System Test Types of Testing Unit Test = Code-based Testing.
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
16 October Reminder Types of Testing: Purpose  Functional testing  Usability testing  Conformance testing  Performance testing  Acceptance.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Automated GUI testing How to test an interactive application automatically?
TEST-1 6. Testing & Refactoring. TEST-2 How we create classes? We think about what a class must do We focus on its implementation We write fields We write.
TESTING LEVELS Unit Testing Integration Testing System Testing Acceptance Testing.
Software Testing Process By: M. Muzaffar Hameed.
Week 14 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Testing, Testing & Testing - By M.D.ACHARYA QA doesn't make software but makes it better.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Automated Testing Gireendra Kasmalkar Prabodhan Exports Pvt. Ltd.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Lecture Videos will no longer be posted. Assignment 3 is due Sunday, the 8 th, 7pm. Today: –System Design,
Software Testing Process
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Overview of the Spring Framework Introducing.
Automated Testing in Sakai Testing applications and services in isolation and in context Josh Holtzman, UC Berkeley David Haines, University of Michigan.
Whole Test Suite Generation. Abstract Not all bugs lead to program crashes, and not always is there a formal specification to check the correctness of.
Testing JUnit Testing. Testing Testing can mean many different things It certainly includes running a completed program with various inputs It also includes.
Testing and Evolution CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Northwest Arkansas.Net User Group Jay Smith Tyson Foods, Inc. Unit Testing nUnit, nUnitAsp, nUnitForms.
Tool Support for Testing Classify different types of test tools according to their purpose Explain the benefits of using test tools.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Items to consider before automating an application
SOFTWARE TESTING Date: 29-Dec-2016 By: Ram Karthick.
Software Testing.
Test Automation CS 4501 / 6501 Software Testing
Software testing
Chapter 8 – Software Testing
Introduction to Software Testing
Testing and Test-Driven Development CSC 4700 Software Engineering
Test Automation CS 4501 / 6501 Software Testing
Automated test.
Designing For Testability
Overview Activities from additional UP disciplines are needed to bring a system into being Implementation Testing Deployment Configuration and change management.
Test-Driven Development
Automated test.
Presentation transcript:

Testing PA165 Dec 9, 2014 Petr Adámek, Tomáš Pitner

Testing of Applications ˂ Testing verifies compliance with the specification and implementation of customer expectations. ˂ It is an important part of the quality management in software development. ˂ Unlike formal verification does not allow to detect all potential errors. <2><2>

Základní pravidla ˂ Tests should be reproducible. ˂ Somebody else should be able to perform the same tests with the same results. ˂ Tests should be deterministic, i.e. they should have the same input conditions at the beginning. ˂ Tests should be independent, i.e. not to be influenced by each other. ˂ Usually by setting the same input conditions for each test ˂ Tests should be repeatable cheaply. ˂ It usually means running in an automated way. <3><3>

Modes of Testing ˂ Manual testing: ˂ low entry costs; ˂ expensive repetitions; ˂ difficult to ensure reproducibility, determinism and independence ˂ Automated testing: ˂ high input costs; ˂ cheap repetition; ˂ easy to ensure reproducibility, determinism and independence. <4><4>

Types of Testing According to Goals ˂ Unit testing ˂ Does the unit work independently on the context? ˂ Integration testing ˂ Does the component work integrated in its environment? ˂ Functional testing ˂ Does it fulfill the functional requirements? ˂ Acceptance Testing ˂ Is it good for the customers? Will they accept it? <5><5>

Types of Testing According to Goals ˂ Performance and scalability testing ˂ Testing the user-friendliness ˂ Security testing <6><6>

Unit Testing ˂ In unit testing we try to test the individual components of the system being developed at the lowest level. ˂ Individual test components should be isolated from its surroundings to avoid the influence of the surroundings on the test component. ˂ Interaction with the environment is simulated using mock-objects that simulate the behavior of the neighborhood in a particular test scenario. ˂ The better the decomposition is done, the easier the unit testing is. <7><7>

Tools for Unit Testing ˂ JUnit ˂ TestNG <8><8>

Example public class CalculatorTest { private Calculator public void setUp() { c = new Calculator(); public void testDivide() { assertEquals( 9, c.divide( 99, 10)); assertEquals(10, c.divide(100, 10)); = IllegalArgumentException.class) public void testDivideByZero() { c.divide(100, 0); } <9><9>

Basic Rules ˂ The test outputs are always Yes / No (Boolean) ˂ First test, then code (see XP and TDD) ˂ When the error is to be corrected: first test, then fix (protection against regression) ˂ Trivial get / set methods are not tested ˂ Test all non-standard situations and limit values ˂ Error messages and comments not always needed ˂ Tests runs after every change

Interactions with Environment ˂ Components should be tested in isolation. ˂ But it is necessary to simulate the kind of interaction with the environment. ˂ That is what Mock objects do. ˂ These objects must be type compatible with simulated component: ˂ Inheritance ˂ Implementing an interface (preferable) ˂ Mock objects can be created manually (tedious), or through tooling: ˂ Mockito, EasyMock, JMock

Example (manually created Mock objects) public class CurrencyConvertorTest public void testConvert() { ExchangeRateTable exchangeRateTable = new ExchangeRateTable() { public void setExchangeRate(Currency currency, BigDecimal exchangeRate) { throw new UnsupportedOperationException("Not supported yet."); } public BigDecimal getExchangeRate(Currency currency) { return BigDecimal.valueOf(28.2); } }; CurrencyConvertor convertor = new CurrencyConvertor(exchangeRateTable); Currency czk = Currency.getInstance("CZK"); BigDecimal actualResult = convertor.convert(czk, BigDecimal.valueOf(10)); BigDecimal expectedResult = BigDecimal.valueOf(282.0); assertEquals(expectedResult, actualResult) }

Example public class CurrencyConvertorTest ExchangeRateTable public void testConvert() { when(exchangeRateTable.getExchangeRate(czk)). thenReturn(BigDecimal.valueOf(28.2)); CurrencyConvertor convertor = new CurrencyConvertor(exchangeRateTable); Currency czk = Currency.getInstance("CZK"); BigDecimal actualResult = convertor.convert(czk, BigDecimal.valueOf(10)); BigDecimal expectedResult = BigDecimal.valueOf(282.0); assertEquals(expectedResult, actualResult) }

Unit Testing in Java EE ˂ For Java EE applications, it is necessary to take into account the existence of the container. ˂ Tests outside the container - test only business logic, not behavior depending on the container (such as transaction management, authorization, etc.) ˂ Tests in a container - will test everything, but this kind of testing for unit tests not fit. ˂ In testing outside of the container concept is used mock objects which simulate the behavior of the container.

Unit Testing - Data ˂ How to test data persistence layer: ˂ Mock objects (easy with JPA or other libraries and frameworks, complicated by the low-level JDBC). ˂ Database is stored in memory (easy for JPA, with low-level JDBC may be a problem with the SQL dialect). ˂ Do not forget to provide the same initial conditions (state database is always the same initial state). ˂ What can help ˂ DBUnit ˂ Abstract DAO

What else can help? ˂ Tools for measuring test coverage ˂ Line Coverage ˂ Branch Coverage ˂ Tools for generating test data ˂ Extended set of assert methods ˂ Etc.

Integration Testing ˂ Integration testing is used to verify the correct interaction of individual components that are assembled and the system behaves as expected in its specification. ˂ See also continuous integration

Functional Testing ˂ Functional testing is used to verify the functionality of the end-user perspective. ˂ Mostly performed at the user interface level ˂ Rational Functional Tester - web GUI+ ˂ 01.ibm.com/software/awdtools/tester/functional/index.html ˂ Selenium IDE – web ˂ ˂ Marathon – GUI ˂ ˂ Rational Robot - GUI(for legacy applications), Rational Quality Manager, JWebUnit

Acceptance Testing ˂ Customer acceptance testing verifies that the application meets customer’s requirements and expectations. ˂ Absence of acceptance testing (or its underestimation and lack of design) almost always leads to future disputes and problems. ˂ Customers unfortunately have a tendency to underestimate it. The non-compliance of the implementation with the customer’s requirements so often comes at the moment of production deployment :-(.

Performance and Scalability Testing ˂ Performance testing verifies system throughput and response time at high loads. ˂ Part of the specification should be the definition of the throughput and response times of the prescribed load. ˂ Rational Performance Tester (+ extensions) ˂ 01.ibm.com/software/awdtools/tester/performance/i ndex.htm ˂ Rational Service Tester for SOA Quality (functional testing, performance testing +) ˂ JMeter -

Usability Testing ˂ In the USA a common thing, in Europe still not so obvious and Asia is likely to overtake Europe in this. ˂ The definition of the prototype of the target user. ˂ Select a group of test users (test sample). ˂ Test user is given a list of tasks that are trying to solve without the help of someone else. ˂ His/her behavior is monitored and evaluated. ˂ See Štefkovič, M.: Usability of Web applications. (Bc. Thesis)

Security Testing ˂ Security testing checks resistance against various security attacks. ˂ Tools: ˂ Rational AppScan - web app security testing ˂

Questions ?