Test Driven Development and Refactoring. CSC 440/540: Software Engineering Slide #1

Similar documents
Class 1 Introduction to Selenium, Software Test Life Cycle.

Objectives: On completion of this project the student should be able to:

Chapter 5 Object-Oriented Programming

Topic 16: Validation. CITS3403 Agile Web Development. Express, Angular and Node, Chapter 11

Agile Behaviour Driven Development (BDD) and Integrated Testing with the Cucumber Framework. Melbourne ANZTB SIGIST, 15 th June 2011

OSSW ICOSST 2009, Al-Khawarizmi Institute of Computer Science University of Engineering and Technology, Lahore

Analysis of the Test Driven Development by Example

JUnit 3.8.1, 64. keep it simple stupid (KISS), 48

HOW AND WHEN TO FLATTEN JAVA CLASSES?

void printowing(double amount) { printbanner(); printdetails(); void printdetails(double amount) {

Understading Refactorings

Overview of Eclipse Lectures. Module Road Map

Course December Adrian Iftene

Software Design COSC 4353/6353 D R. R A J S I N G H

Upload to your web space (e.g., UCSC) Due this Thursday 4/8 in class Deliverable: Send me an with the URL Grading:

(Complete Package) We are ready to serve Latest Testing Trends, Are you ready to learn? New Batches Info

Behaviour Driven Development with Java. Nikolay Vasilev 15 July 2011

Software Engineering

ActiveNET Enterprise Solution Company

Sahi. Cost effective Web Automation

VIEW POINT. Choosing the right automation tool and framework is critical to project success. Harsh Bajaj, Technical Test Lead ECSIVS, Infosys

SELENIUM - REMOTE CONTROL

Software Testing

Refactoring with Eclipse

Koenig Solutions Pvt. Ltd. Selenium with C#

Outline. Logistics. Logistics. Principles of Software (CSCI 2600) Spring Logistics csci2600/

DAT159 Refactoring (Introduction)

Adam Carmi Applitools

Lab Exercise Refactoring using Eclipse

AntiPatterns. EEC 421/521: Software Engineering. AntiPatterns: Structure. AntiPatterns: Motivation

Hugbúnaðarverkefni 2 - Static Analysis

Automation Script Development using Capybara

The major elements of the object-oriented model

STQA Mini Project No. 2

Browser Problems In Ajax Applications

Lecture 4: Data Collection and Munging

Efficient Regression Test Model for Object Oriented Software

But before understanding the Selenium WebDriver concept, we need to know about the Selenium first.

BDD als Ansatz zum Automatisierten Testen von GUIs

Abstract: Refactorings are used to improve the internal structure of software without changing its external behavior.

Static & Dynamic Testing using Tools. Created by Kudakwashe K. Chambwe

Test Tools Meet-up. The Server Side Symposium Selenium, soapui, HTMLUnit, TestMaker, TestGen4Web

TESTING WEB SERVICES WITH WEBDRIVER AND QUICKCHECK

Tutorial 02: Writing Source Code

Behat Kickstart. For Drupal 8 Developers. Stanford Drupal Camp 2016 Stanford, CA -- April 1-2, Peter Sawczynec Customer Success Engineer

Open Source Test Automation: Riding the Second Wave

Software Testing 2. OOD and Testability. White box vs Black box Testing. Software Testing 2 Semester 1, 2006

Small changes to code to improve it

WebDriver: Controlling your Web Browser

Measuring Effectiveness of software Quality by Comparing Manual Testing and Selenium

Automation Page Object Pattern with Open Source Framework Ruby - Study Paper

php tek - Chicago, US Derick Rethans -

More on Design. CSCI 5828: Foundations of Software Engineering Lecture 23 Kenneth M. Anderson

Static Analysis Techniques

Java Object Oriented Design. CSC207 Fall 2014

Refactoring. Paul Jackson. School of Informatics University of Edinburgh

Analysis of Various Software Metrics Used To Detect Bad Smells

Usage of Selenium Tool for Regression Testing

CSci 450: Org. of Programming Languages Overloading and Type Classes

Chapter 10. Testing and Quality Assurance

Recap: Class Diagrams

Manual Testing. Software Development Life Cycle. Verification. Mobile Testing

Selenium with Java Syllabus

Software Engineering

JAVA MOCK TEST JAVA MOCK TEST II

Refactoring. Chen Tang March 3, 2004

Effizientere WordPress-Plugin-Entwicklung mit Softwaretests. Martin Schütte

Homework Identify a suitable project topic that conforms to project requirements

The Joy of Software Development

Patterns and Testing

WA1278 Introduction to Java Using Eclipse

SAFEREFACTOR Tool for Checking Refactoring Safety

Emerging trends in test automation

Software Testing Lecture 1. Justin Pearson

COURSE 11 DESIGN PATTERNS

McCa!"s Triangle of Quality

The Next Generation of Eclipse: e4. Mike Milinkovich Executive Director Eclipse Foundation

9/24/2018 Programming Data Structures

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas

Code review guide. Notice: Read about the language that you will test its code, if you don t have an idea about the language this will be difficult.

13 th Annual International Software Testing Conference in India 2013

BCS Higher Education Qualifications. Diploma in IT. Object Oriented Programming Syllabus

Govt. of Karnataka, Department of Technical Education Diploma in Computer Science & Engineering. Fifth Semester. Subject: Web Programming

Refactorings. Refactoring. Refactoring Strategy. Demonstration: Refactoring and Reverse Engineering. Conclusion

By Didier BERNAUDEAU. OSSIR (January 9th, 2018)

Automated Unit Testing A Practitioner's and Teacher's Perspective

JUnit A Study on Applying JUnit Framework to Document Knowledge of Object-Oriented Software Systems

Exploring Languages with Interpreters and Functional Programming Chapter 11

Carrera: Analista de Sistemas/Licenciatura en Sistemas. Asignatura: Programación Orientada a Objetos

CPET 499/ITC 250 Web Systems. Topics

Adding automated tests to existing projects

Web Application Design. Husni Husni.trunojoyo.ac.id

Selenium Testing Course Content

This tutorial will help you understand JSON and its use within various programming languages such as PHP, PERL, Python, Ruby, Java, etc.

Ingegneria del Software Corso di Laurea in Informatica per il Management. Software quality and Object Oriented Principles

3 Continuous Integration 3. Automated system finding bugs is better than people

Quote by Bruce Sterling, from: A Software Testing Primer, Nick Jenkins

Selenium Training. Training Topics

CSC102 INTRO TO PROGRAMMING WITH PYTHON REVIEW MICHAEL GROSSBERG

CHAPTER 11 Refactoring

Transcription:

Test Driven Development and Refactoring CSC 440/540: Software Engineering Slide #1

Topics 1. Bugs 2. Software Testing 3. Test Driven Development 4. Refactoring 5. Automating Acceptance Tests CSC 440/540: Software Engineering Slide #2

Bugs CSC 440/540: Software Engineering Slide #3

Ariane 5 Flight 501 Bug Ariane 5 spacecraft self-destructed June 4, 1996 Due to overflow in conversion from a floating point to a signed integer. Spacecraft cost $1billion to build. CSC 440/540: Software Engineering Slide #4

Software Testing Software testing is the process of evaluating software to find defects and assess its quality. Inputs System Outputs = Expected Outputs? CSC 440/540: Software Engineering Slide #5

Test Granularity 1. Unit Tests Test specific section of code, typically a single function. 2. Component Tests Test interface of component with other components. 3. System Tests End-to-end test of working system. Also known as Acceptance Tests. CSC 440/540: Software Engineering Slide #6

Regression Testing Regression testing focuses on finding defects after a major code change has occurred. Regressions are defects such as Reappearance of a bug that was previous fixed. Features that no longer work correctly. CSC 440/540: Software Engineering Slide #7

How to find test inputs Random inputs Also known as fuzz testing. Boundary values Test boundary conditions: smallest input, biggest, etc. Errors are likely to occur around boundaries. Equivalence classes Divide input space into classes that should be handled in the same way by system. CSC 440/540: Software Engineering Slide #8

How to determine if test is ok? CSC 440/540: Software Engineering Slide #9

Test Driven Development CSC 440/540: Software Engineering Slide #10

Advantages of writing tests first Units tests are actually written. Programmer satisfaction. Clarification of detailed interface and behavior. Provable, repeatable, automated verification. Confidence to change code. CSC 440/540: Software Engineering Slide #11

Refactoring Refactoring is a structured technique for changing the design and implementation of code without changing its functionality. Goals of refactoring Reduce complexity Improve code readability Improve maintainability Improve flexibility CSC 440/540: Software Engineering Slide #12

Refactoring Techniques Techniques for breaking code apart into logical pieces Extract Class moves part of the code from an existing class into a new class. Extract Method turns part of a larger method into a new method, improving method cohesion. Techniques for improving names and location of code Move Method or Move Attribute move to a more appropriate class or source file. Rename Method or Rename Attribute change name to a new one that better reveals purpose. Pull Up move method or attribute to a superclass Push Down move method or attribute to a subclass CSC 440/540: Software Engineering Slide #13

Refactoring Techniques Techniques that allow for more abstraction Encapsulate Field force code to access the field with getter and setter methods, reducing coupling. Generalize Type create more general types to allow for more code sharing Replace conditional with polymorphism. There are many other refactorings. See http://refactoring.com/catalog/ Or Martin Fowler s book Refactoring CSC 440/540: Software Engineering Slide #14

Acceptance Test Frameworks Cucumber (Ruby) Uses declarative language to describe tests. Similar tools: Behat (PHP), Lettuce (Python), JBehave Fit (Framework for Integrated Test) Customers provide examples formatted as tables Fit checks document and fills in table red/green. Selenium (Selenese DSL) Software testing framework for web applications. Can use record/playback tool without scripting. Ports: C#, Java, Perl, PHP, Python, Ruby CSC 440/540: Software Engineering Slide #15

Web Automation HtmlUnit Java based headless browser with JS. Mechanize Automates HTTP form interactions, but not JS. Available for Ruby, Python, and Perl. PhantomJS Headless, scriptable WebKit browser with JS, HTML5 CasperJS same interface with Firefox browser. TrifleJS same interface with IE browser. ScriptableBrowser Headless browser that s part of PHP SimpleTest. Spynner Headless WebKit browser with AJAX support for Python. CSC 440/540: Software Engineering Slide #16

References 1. Ross Anderson, Security Engineering, Wiley, 2001. 2. Matt Bishop, Introduction to Computer Security, Addison-Wesley, 2005. 3. Peter Neumann, (moderator), Risks Digest, http://catless.ncl.ac.uk/risks/ 4. Bruce Schneier, Beyond Fear, Copernicus Books, 2003. 5. Ken Thompson, Reflections on Trusting Trust, Communication of the ACM, Vol. 27, No. 8, August 1984, pp. 761-763 (http://www.acm.org/classics/sep95/) CSC 440/540: Software Engineering Slide #17