Testing Especially Unit Testing. V-model Wikipedia:

Slides:



Advertisements
Similar presentations
DETAILED DESIGN, IMPLEMENTATIONA AND TESTING Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Advertisements

Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
1 Software Engineering Lecture 11 Software Testing.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Black box testing  Black box tests focus on the input/output behavior of the component  Black-box tests do not deal with the internal aspects of the.
Approach of Unit testing with the help of JUnit Satish Mishra
November 2005J. B. Wordsworth: J5DAMQVT1 Design and Method Quality, Verification, and Testing.
1 CODE TESTING Principles and Alternatives. 2 Testing - Basics goal - find errors –focus is the source code (executable system) –test team wants to achieve.
Software Engineering Testing Lecture 4 ASPI8-4 Anders P. Ravn, Feb 2004.
Illinois Institute of Technology
Equivalence Partitioning Identify the inputs, behaviors, or other factors that you want to test based on the functionality and specifications Group these.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
System/Software Testing
Lecture 6 Software Testing and jUnit CS140 Dick Steflik.
Software testing techniques Software testing techniques Testing based on specifications Presentation on the seminar Kaunas University of Technology.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Categories of Testing.
Software Testing CS 121 “Ordering Chaos” “Mike” Michael A. Erlinger
Database testing Prepared by Saurabh sinha. Database testing mainly focus on: Data integrity test Data integrity test Stored procedures test Stored procedures.
Objectives Understand the basic concepts and definitions relating to testing, like error, fault, failure, test case, test suite, test harness. Explore.
Let us start from the V-Model Verification Phases Requirements analysis System Design Architecture Design Module Design Coding Validation phases Unit.
Software Systems Verification and Validation Laboratory Assignment 3 Integration, System, Regression, Acceptance Testing Assignment date: Lab 3 Delivery.
CMSC 345 Fall 2000 Unit Testing. The testing process.
A Safety-Critical Java Technology Compatibility Kit Hans Søndergaard Stephan Korsholm VIA University College, Horsens, Denmark & Anders P. Ravn Aalborg.
Testing : A Roadmap Mary Jean Harrold Georgia Institute of Technology Presented by : Navpreet Bawa.
Lecture 11 Testing and Debugging SFDV Principles of Information Systems.
Contract based programming Using pre- and post-conditions, and object invariants Contract based programming1.
Testing Workflow In the Unified Process and Agile/Scrum processes.
Test Driven Development Arrange, Act, Assert… Awesome Jason Offutt Software Engineer Central Christian Church
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
Software Testing. 2 CMSC 345, Version 4/12 Topics The testing process  unit testing  integration and system testing  acceptance testing Test case planning.
1 Intro to Java Week 12 (Slides courtesy of Charatan & Kans, chapter 8)
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
(1) Unit Testing and Test Planning CS2110: SW Development Methods These slides design for use in lab. They supplement more complete slides used in lecture.
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.
A tool for test-driven development
What is Testing? Testing is the process of finding errors in the system implementation. –The intent of testing is to find problems with the system.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Software Testing and Quality Assurance 1. What is the objectives of Software Testing?
1 Unit Testing with JUnit CS 3331 JUnit website at Kent Beck and Eric Gamma. Test Infected: Programmers Love Writing Tests, Java Report,
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
Unit Testing with FlexUnit
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
Test. V-model Wikipedia:
Topics  Direct Predicate Characterization as an evaluation method.  Implementation and Testing of the Approach.  Conclusions and Future Work.
Database Testing Gourav Mehta (Associate QA Engineer)
Section 2.4 Software Testing. 2.4 Software Testing The process of executing a program with data sets designed to discover errors Software testing is one.
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
Software Testing.
Domain Testing Functional testing which tests the application by giving inputs and evaluating its appropriate outputs. system does not accept invalid and.
Testing Tutorial 7.
Software Testing.
SOFTWARE TESTING OVERVIEW
Different Types of Testing
Chapter 8 – Software Testing
Software Testing Software testing.
Quality Management Perfectqaservices.
LECTURE 8: Software Testing
UNIT-4 BLACKBOX AND WHITEBOX TESTING
LECTURE 10: Software Testing
Advanced Programming Behnam Hatami Fall 2017.
Chapter 10 – Software Testing
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Automated test.
CSE 1020:Software Development
Automated test.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing.
Presentation transcript:

Testing Especially Unit Testing

V-model Wikipedia:

Verification & Validation Verification Phases Requirements analysis System Design Architecture Design Module Design Validation Phases Unit Testing Integration Testing System Testing User Acceptance Testing

Types (or Stages) of Testing (Validation) Developer Testing Normal testing by the developer / programmer – to see it do work Independent and Stakeholder Testing Independent Testing denotes the test design and implementation that it is most appropriate for someone independent from the team of developers to do. Unit Tests Systematic automatic test of a unit (testing from a black box view) – our focus Integration Test integration testing is performed to ensure that the components in combination do work (e.g. that classes across packages do work) System Test System testing is done when the software is functioning as a whole. Do the whole system works Acceptance Test The users do the testing and accepting as a final test action prior to deploying the software. Check that all use-cases and all non-functional requirements work

Unit testing White box testing where you check all programming lines have been executed with an accepted result Black box testing where you check all methods have been executed and all parameter boundaries have been checked – of cause again with an accepted result

Black-box (UPedu) input argument Normal values from each equivalence class. Values on the boundary of each equivalence class. Values outside the equivalence classes. Illegal values. output argument Normal values from each equivalence class. Values on the boundary for each equivalence class. Values outside the equivalence classes. Illegal values.

Set up test-cases Follow / Fill out schema Test case # Description of test case Expected value Passed succesfully 1...

Example - Person Constrains: ID a number between Name a text which is not null and at least 4 character long Phone a number of 8 digits

Test case # Description of test caseExpected value Passed successfully 1Default constructorObject created 2Set ID – value 999ArgumentException 3Set ID – value 1000ID == Set ID – value 99999ID == Set ID – value ArgumentException 6Set ID – value 5678ID == Set ID – value -5ArgumentException 8Set Name – value nullArgumentException 9Set Name – value empty (“”)ArgumentException 10 Set Name – value not empty but less than 4 value “123” ArgumentException 11 Set Name – value not empty and 4 value “1234” Name == “1234” 12Set Name – value not empty and 15 value “ ” Name == “ ”

13Set Phone – value ArgumentException 14Set Phone – value Phone == Set Phone – value Phone == Set Phone – value ArgumentException 17Set Phone – value Phone == Set Phone – value -5ArgumentException 19Constructor(2222,”Susanne”, ) ID == 2222 Name == “Susanne” Phone == Constructor(00999,”Susanne”, )ArgumentException 21Constructor(2222,null, )ArgumentException 22Constructor(2222,”Per”, )ArgumentException 23Constructor(2222,”Susanne”, )ArgumentException

Model Driven Development> Identify New Functionality Write TestRun Test Implement Functionality and Refactor Pass Fail

Running tests in Visual Studio [TestMethod] public void convertToInt() { } public static int convertToInt(string binaryNumber) { throw new NotImplementedException(); }

A class that needs to be implemented public class BinaryHelper { public static bool greaterThan(string p1, string p2) { throw new NotImplementedException(); } public static bool smallerThan(String p1, String p2) { throw new NotImplementedException(); }

Unit tests [TestClass] public class BinaryHelperTest { [TestMethod] public void greaterThanTest() { } [TestMethod] public void smallerThan() { }

Tool to generate first part of Unit Test Unit Test Generator – to download and install Link: 8cff-165b505a38d7 8cff-165b505a38d7 For more information:

The Assert class Method NameDEscription AreEqual(Object, Object)Verifies that two specified objects are equal. The assertion fails if the objects are not equal. (Overwritten with allprimitive datatypes) AreNotEqual(Object, Object)Verifies that two specified objects are not equal. The assertion fails if the objects are equal.(Overwritten with allprimitive datatypes) AreSame(Object, Object)Verifies that two specified object variables refer to the same object. The assertion fails if they refer to different objects. AreNotSame(Object, Object)Verifies that two specified object variables refer to different objects. The assertion fails if they refer to the same object.

The Assert class continued Method NameDEscription IsFalse(Boolean)Verifies that the specified condition is false. The assertion fails if the condition is true. IsTrue(Boolean)Verifies that the specified condition is true. The assertion fails if the condition is false. IsNull(Object)Verifies that the specified object is null. The assertion fails if it is notnull. IsNotNull(Object)Verifies that the specified object is not null. The assertion fails if it isnull.

Mock objects

Test Student Class

Using Mock objects

Moq4 A mock object framework for MStest

Moq4 example public void CompleteCourseTest() { // setup mock activity var c = new Mock (); c.Setup(m => m.GetName()).Returns("Programming"); c.Setup(m => m.getECTS()).Returns(15); // test with mock activity Student s = new Student(); Assert.IsTrue(s.EnrollActivity(c.Object)); }