Unit Testing for the Absolute Beginner

Slides:



Advertisements
Similar presentations
Transfer of Funds Auxiliary Voucher.
Advertisements

Software Testing Fundamentals
Requirements and Design
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. Chapter Three - Implementing Classes.
Chapter 12 ATM Case Study, Part 1: Object-Oriented Design with the UML
Cash Funds Making Accounting Relevant In the workplace, many people handle cash. Protecting cash from theft or loss is important. Making Accounting Relevant.
Unit testing C# classes “If it isn’t tested it doesn’t work” Unit testing C# classes1.
Equivalence Partitioning Identify the inputs, behaviors, or other factors that you want to test based on the functionality and specifications Group these.
 A General Ledger identifies each account individually and includes posted transactions and balances. ◦ Posting is the process of transferring original.
Testing Especially Unit Testing. V-model Wikipedia:
INT-Evry (Masters IT– Soft Eng)IntegrationTesting.1 (OO) Integration Testing What: Integration testing is a phase of software testing in which.
 What is the general journal used for?  How do we enter transactions in the general journal? LESSON REVIEW.
OBJECT ORIENTED SYSTEM ANALYSIS AND DESIGN. COURSE OUTLINE The world of the Information Systems Analyst Approaches to System Development The Analyst as.
Software Life Cycle Requirements and problem analysis. –What exactly is this system supposed to do? Design –How will the system solve the problem? Coding.
Test Driven Development Arrange, Act, Assert… Awesome Jason Offutt Software Engineer Central Christian Church
ACO 101: Introduction to Computer Science Anatomy Part 2: Methods.
ACO 101 Instantiating Graphic Objects. Review: 4 Phases to the Development Lifecycle Inception (Analysis & Design) – Business Requirements Business Analyst.
Unit Testing Building Rock-Solid Software SoftUni Team Technical Trainers Software University
Posting from a General Journal to a General Ledger Accounting I Chapter 4, Section 3.
 28object-oriented_programming%29 28object-oriented_programming%29.
Accounting I/II Chapter 2, Section 1.  T- accounts  An accounting device used to analyze transactions  Debit  An amount recorded on the left side.
Chapter 17 – Object- Oriented Design. Chapter Goals To learn about the software life cycle To learn about the software life cycle To learn how to discover.
© 2016 Pearson Education, Inc. Appendix C Accounting Information Systems.
CENTURY 21 ACCOUNTING © Thomson/South-Western LESSON 4-2 Posting Separate Amounts from a Journal to a General Ledger.
CENTURY 21 ACCOUNTING © 2009 South-Western, Cengage Learning LESSON 4-3 Posting Column Totals from a Journal to a General Ledger.
Problem 1 Bank.  Manage customers’ bank account using the following operations: Create a new account given a customer’s name and initial account. Deposit.
Unit Testing Building Rock-Solid Software Svetlin Nakov Technical Trainer Software University
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
Inheritance and Subclasses CS 21a. 6/28/2004 Copyright 2004, by the authors of these slides, and Ateneo de Manila University. All rights reserved L16:
CENTURY 21 ACCOUNTING © Thomson/South-Western LESSON 4-3 Posting Column Totals from a Journal to a General Ledger.
Beginning Software Craftsmanship Brendan Enrick Steve Smith
 An object is basically anything in the world that can be created and manipulated by a program.  Examples: dog, school, person, password, bank account,
Accounting Cycle.
Unit testing Why test your code when your code can test it for you?
Building Rock-Solid Software
Test Granularities Unit Testing and Automation
ATM OO Design and Implementation Case Study
Recording Daily General Journal entries in a manual system
Classes Object-oriented programming: Example: Bank transactions
Software Testing Software testing.
Inheritance in Java.
Implementing Classes Yonglei Tao.
LESSON 4-2 Posting from a General Journal to a General Ledger
An Introduction to Visual Basic .NET and Program Design
Unit testing C# classes
Chapter Three - Implementing Classes
Component Testing (Unit Testing)
VISUAL BASIC – CHAPTER ONE NOTES An Introduction to Visual Basic
Business Accounting Chapter 7.
CHECK MARKS SHOW THAT AMOUNTS ARE NOT POSTED
The Object-Oriented Thought Process Chapter 04
Introduction to Objects
The Accounting Cycle The accounting cycle helps to keep accounting records in an orderly fashion. Collect and verify source documents Analyze each transaction.
Lesson 4-3 Posting Column Totals from a Journal to a General Ledger
Software Engineering System Modeling Chapter 5 (Part 1) Dr.Doaa Sami
Lesson 4-3 Posting Column Totals from a Journal to a General Ledger
Lesson 4-2 Posting Separate Amounts from a Journal to a General Ledger
LESSON 4-2 Posting from a General Journal to a General Ledger
JAVA CLASSES.
Introduction Start.
Point 4 The double-entry system
Automated test.
Lesson 4-3 Posting Column Totals from a Journal to a General Ledger
Lesson 4-2 Posting Separate Amounts from a Journal to a General Ledger
Introduction to Object-Oriented Programming
Navigation through Source Code
Verify Charges under ZFB61 DPI Vehicle Fleet Management NS-3
Automated test.
Chapter 10 $ Section 2 Posting Closing Entries and Preparing a Post-Closing Trial Balance $ What You’ll Learn How to record closing entries in the general.
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

Unit Testing for the Absolute Beginner Carolyn Schroeder, October 16, 2017

What is Unit Testing Unit Testing involves testing individual units of software A unit usually has one or a few inputs and usually a single output In object oriented programming, the smallest unit is a method

Why do Unit Testing? Unit Testing increases confidence in changing code With test driven development, you create the unit tests before you write the code, so you use the unit tests as both design documentation and functional specifications.

How do we set up Unit Tests? Create unit tests that verify the behavior of the code in response to standard, boundary, and incorrect cases of input data Asserts are made about expected output Unit tests can also indicate the an exceptions is expected

Our Example We are going to create a class for simple bank account transactions It should handle crediting and debiting amounts of money

What should we test? Credit and Debit methods produce the right balance It is not possible to debit and amount larger than the balance All amounts to be credited and debited are larger than or equal to zero

Creating Unit Tests I will be using MSTest in Visual Studio 2017 A Unit Test Class must be public and decorated with the TestClass attribute A Unit Test method must be public and decorated with the TestMethod attribute Methods must have a void return type

Unit Test vs Integration Testing Now we have established the BankAccount class is working right Bank Account balances would held in a data access layer Suppose we wanted to test the interaction between the data access layer and a BankService This would be integration testing

Fakes The solution is to fake the data access layer and only test that the service is returning the right value This is done using interfaces I am going to create a data access repository interface I am going to use Fake It Easy to fake the interface

Set up The IRepository inteface has just one method GetBalance The interface is injected into the Bank Service We test that the BankService is returning the right value

Resources https://github.com/carolynlschroeder/Unit TestingDemo http://schroederconsulting.business