Test Driven Development and NUnit Testing -Adam Main.

Slides:



Advertisements
Similar presentations
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Advertisements

Computer Science 209 Testing With JUnit. Why Test? I don ’ t have time, I ’ ve got a deadline to meet The more pressure I feel, the fewer tests I will.
Extreme Programming Programming Practices Object Mentor, Inc. Copyright  by Object Mentor, Inc All Rights Reserved Portions of this material.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
What is Unit Testing? How TDD Works? Tsvyatko Konov Telerik Corporation
MAHDI OMAR JUNIT TUTORIAL. CONTENTS Installation of Junit Eclipse support for Junit Using Junit exercise JUnit options Questions Links and Literature.
A Brief Introduction to Test- Driven Development Shawn M. Jones.
Test-Driven Development. Why Testing is Important? “If you don’t have tests, how do you know your code is doing the thing right and doing the right thing?”
TEST-DRIVEN DEVELOPMENT Lecture 3. Definition Test-driven development (development through testing) is a technique of programming, in which the unit tests.
Copyright © 2006 Korson-Consulting 1/219 Unit 4 Test First Development.
TDD Test-Driven Development. JUnit 4.0 To use annotations need to import org.junit.Test To use assertion need to import org.junit.Assert.* No need to.
Unit testing C# classes “If it isn’t tested it doesn’t work” Unit testing C# classes1.
Automated Testing Nathan Weiss April 23, Overview History of Testing Advantages to Automated Testing Types of Automated Testing Automated Testing.
SW Testing - part of a better Process CERN-BE-BI-SW Training Day M.Andersen.
Continuous Integration April 2014 tap|QA Presentation.
TDD,BDD and Unit Testing in Ruby
Test Driven Development TDD. Testing ”Testing can never demonstrate the absence of errors in software, only their presence” Edsger W. Dijkstra (but it.
Introduction to Unit Testing Jun-Ru Chang 2012/05/03.
By Roland Foster Supervisors: Mr. Mehrdad Ghaziasgar Mr. James Connan Mentor: Mr. Warren Nel.
Programming By Intention/ Intro to JUnit. Admin ► Astels, p. 50 – “The test in the section titled Programming by Intention…” should read “The test in.
P Object type and wrapper classes p Object methods p Generic classes p Interfaces and iterators Generic Programming Data Structures and Other Objects Using.
Code Correctness, Readability, Maintainability Telerik Software Academy Telerik School.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
© Copyright 2005, thycotic. Test Driven Development Jonathan Cogley Maryland Cold Fusion User's Group 10/11/2005.
CSC 211 Introduction to Design Patterns. Intro to the course Syllabus About the textbook – Read the introduction and Chapter 1 Good attendance is the.
© ALEXANDRE CUVA  VERSION 2.00 Test Driven Design.
October, 2006 © Copyright 2006, Larry A. Beaty. Copying and distribution of this document is permitted in any medium, provided this notice is preserved.
Software Engineering 1 Object-oriented Analysis and Design Chap 21 Test-Driven Development and Refactoring.
By for Testing Tools: Test Automation and supporting tools Jariro Pava, Robert Vanderwall 1 WISTPC-14.
BIT 142:Programming & Data Structures in C#. What is Unit Testing? 2.
Introduction to Unit Testing. Unit testing – testing methods/classes of the program Test suite is composed of several tests Test suite should cover all.
First BlueJ Day Houston, 2006 Unit Testing with BlueJ Bruce Quig Deakin University.
JUnit Adam Heath. What is JUnit?  JUnit is a unit testing framework for the Java programming language  It allows developers to swiftly and easily test.
COSC 643 Final Exam Review Sungchul Hong. Types of Questions Multiple choice True/False Short answer Analysis (Short essay)
NUnit 1.  What Is NUnit?  NUnit is a unit-testing framework for all.Net languages. Initially ported from JUnit, the current production release, version.
By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development (TDD)
Copyright © 2005 Charlie Poole. All rights reserved Test First User Interfaces XP2005 Sheffield University June 18, 2005.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
Test Driven Development Daniel Brown dxb17u. Introduction Originates from Extreme Programming (XP) Proposed by Kent Beck in Test Driven Development.
Dave Lloyd Unit Testing in the Real World.
Functions Sujana Jyothi C++ Workshop Day 2. Functions 3 Parameter transmission modes pass by value (default) pass by reference (&) pass by const reference.
Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Genesis.
Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping.
Object Oriented Software Development 4. C# data types, objects and references.
2-1 By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development.
Test-Driving ASP.NET Development Tampa Code Camp – July 15 th, 2006 Cory Foy
Unit Testing Building Rock-Solid Software Svetlin Nakov Technical Trainer Software University
By Roland Foster Supervisors: Mr. Mehrdad Ghaziasgar Mr. James Connan Mentor: Mr. Warren Nel.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
Tools for Automated Testing Presented by: Žygimantas Mockus.
Unit testing with NUnit Anne Lam & Chris James CMPS 4113 – Software Engineering April 15, 2015.
Software Engineering Lecture 11 Software Testing Presenter: Josef Hallberg 1.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Agile Development VS 2005 Team vs. Open Source Toolkit Michael Gillespie James Brown Agillence Software Inc.
Building Rock-Solid Software
Test-driven development
Test-Driven Development
TESTING TEST DRIVEN DEVELOPMENT
3 Introduction to Classes and Objects.
CIT 590 Unit testing.
Unit Testing with xUnit.net
Introduction to JUnit CS 4501 / 6501 Software Testing
Test Driven Development
Test Driven Development 1 November Agenda  What is TDD ?  Steps to start  Refactoring  TDD terminology  Benefits  JUnit  Mocktio  Continuous.
Lecture 7 Designing Classes
Unit testing C# classes
Component Testing (Unit Testing)
TDD adoption plan 11/20/2018.
Introduction to JUnit CS 4501 / 6501 Software Testing
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Presentation transcript:

Test Driven Development and NUnit Testing -Adam Main

What is Test Driven Development? b 2 Rules Write new code only when a test failsWrite new code only when a test fails Eliminate duplicationEliminate duplication b Failing to compile is failing a test

Basic Process 1. Write a test that fails 2. Write code to pass the test 3. Refactor the code 4. If the program isn’t finished, goto 1

Advantages b Concise and simple b Less manual testing b Know specs and requirements b Higher percent code coverage b Highly testable code b Coupling and cohesion

Disadvantages b High number of compiles Wastes timeWastes time Less thoughtLess thought b Very little design minutes15-20 minutes LanguageLanguage HardwareHardware

What is NUnit? b Based off of xUnit JUnit -JavaJUnit -Java b Basic testing framework b.NET environment b Uses metadata b Console and GUI testing apps

Why NUnit? b Simple Interface b Constant Feedback b XML results b Configurable SubsetsSubsets PackagesPackages SolutionsSolutions

How do you use NUnit? b Metadata attribute tags b Assert library calls b GUI or console application

What are Attribute tags? b.NET b [Attribute] b Metadata b “Compilable comments”

Attribute Tags b [TestFixture] b [Test] b [TestFixtureSetUp] b [TestFixtureTearDown]

More Attribute Tags b [ExpectedException(typeof(ExceptionType))] b [Category("Category Name")] b [Explicit] b [Ignore(“reason”)]

What is the Assert Library b Created by NUnit team b Static functions b Assert class

Assert Functions b 3 Basic Overloads -Assert.IsFalse( bool condition); -Assert.IsFalse( bool condition, string message ); -Assert.IsFalse( bool condition, string message, object[] parms ); b One Assert per test Short circuitShort circuit Simple and concise testsSimple and concise tests

Assert Functions  AreEqual(int actual, int expected)  AreEqual(double actual, double expected)  AreEqual(float actual, float expected)  AreEqual(decimal actual, decimal expected)  AreEqual(object actual, object expected)  AreSame (object actual, object expected)

Assert Functions  IsTrue( bool condition)  IsFalse( bool condition)  IsNull( object obj)  IsNotNull( object obj)  Fail()  Ignore()

Projects b Load VS projects/solutions b Save selected tests b.nunit

Demo b Create a simple b Use TDD b Use NUnit

Sources b [1] NUnit - Documentation. Retrieved March 28, 2005, from b [2] George, Boby and Laurie Williams. An Initial Investigation of Test Driven Development in Industry. Retrieved March 30, 2005, from b [3] Ganssle, Jack. XP Deconstructed. Dec 10, b [4] Provost, Peter. Test Driven Development in.NET. b [5] Introduction to Test Drive Development (TDD). Retreived April 1, 2005, from b [6] Mugridge, Rick. Test Driven Development and the Scientific Method.