Image processing algorithm regression testing framework Soumik Ukil.

Slides:



Advertisements
Similar presentations
Lecture 8: Testing, Verification and Validation
Advertisements

Testing and Quality Assurance
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Objectives Understand the basic concepts and definitions relating to testing, like error, fault, failure, test case, test suite, test harness. Understand.
The Basics of Software Testing
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Outline Types of errors Component Testing Testing Strategy
Software Testing Prasad G.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
Unit Testing Using PyUnit Monther Suboh Yazan Hamam Saddam Al-Mahasneh Miran Ahmad
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
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.
Introduction to Unit Testing Jun-Ru Chang 2012/05/03.
TESTING.
Objectives Understand the basic concepts and definitions relating to testing, like error, fault, failure, test case, test suite, test harness. Explore.
© 2012 IBM Corporation Rational Insight | Back to Basis Series Chao Zhang Unit Testing.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Chapter 8 – Software Testing Lecture 1 1Chapter 8 Software testing The bearing of a child takes nine months, no matter how many women are assigned. Many.
Testing Basics of Testing Presented by: Vijay.C.G – Glister Tech.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Testing Workflow In the Unified Process and Agile/Scrum processes.
Exploring an Open Source Automation Framework Implementation.
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Software Construction Lecture 18 Software Testing.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Chapter 8 Testing. Principles of Object-Oriented Testing Å Object-oriented systems are built out of two or more interrelated objects Å Determining the.
Software Testing and Quality Assurance 1. What is the objectives of Software Testing?
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Cross Language Clone Analysis Team 2 February 3, 2011.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
 Software Testing Software Testing  Characteristics of Testable Software Characteristics of Testable Software  A Testing Life Cycle A Testing Life.
Dynamic Testing.
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
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
JRA1 Testing Current Status Leanne Guy Testing Coordination Meeting, 13 th September 2004 EGEE is a project funded by the European.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
SOFTWARE TESTING SOFTWARE TESTING Presented By, C.Jackulin Sugirtha-10mx15 R.Jeyaramar-10mx17K.Kanagalakshmi-10mx20J.A.Linda-10mx25P.B.Vahedha-10mx53.
Mutation Testing Laraib Zahid & Mariam Arshad. What is Mutation Testing?  Fault-based Testing: directed towards “typical” faults that could occur in.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
REGRESSION TESTING Audrius Čėsna IFM-0/2. Regression testing is any type of software testing that seeks to uncover new errors, or regressions, in existing.
Subject Name: Software Testing Subject Code: 10CS842 Prepared By:
Software Testing.
SOFTWARE TESTING Date: 29-Dec-2016 By: Ram Karthick.
Software Testing Basics
Software Testing.
Software Testing.
Chapter 9, Testing.
Chapter 8 – Software Testing
Verification and Testing
Chapter 13 & 14 Software Testing Strategies and Techniques
Types of Testing Visit to more Learning Resources.
COTS testing Tor Stålhane.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
Lecture 09:Software Testing
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.
Software Verification and Validation
Software Verification and Validation
Software Verification and Validation
Java & Testing.
Chapter 11: Integration- and System Testing
Integration Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

Image processing algorithm regression testing framework Soumik Ukil

Testing Ground Rules  Objectives:  Testing is the process of executing a program with the intent of finding errors  A good test case is one that has a high probability of finding an error  A successful test is one that uncovers an error  However, testing cannot show the absence of defects

 Unit Testing :  Testing to determine that individual program modules perform to specification  Basic units of software tested in isolation  Regression Testing :  Selective retesting to detect faults introduced during modification of system  Should be performed after any changes in software like bug fixes

Motivation Projects like NETT and BRP Projects like NETT and BRP Complex algorithms which run on hundreds of datasets Complex algorithms which run on hundreds of datasets Source is being constantly modified to fix bugs etc Source is being constantly modified to fix bugs etc Manual testing infeasible Manual testing infeasible Need automated regression testing Need automated regression testing

Testing Strategies Dynamic Analysis Dynamic Analysis Exercise the software in its execution environment Exercise the software in its execution environment Black Box Black Box Treat the system as black -box, ie no knowledge of internal structure Treat the system as black -box, ie no knowledge of internal structure Only need to know legal input and expected output Only need to know legal input and expected output White Box White Box Depends on Internal structure of program Depends on Internal structure of program Test all paths through code Test all paths through code

Testing Strategies  Static Analysis  Code Reviews  Walkthroughs  Inspections

Tests on image data  Gold-standard data used as basis for correctness of output  Black box tests :  Already know 'correct' output  Generate data from algorithm  Define tests that compare the two sets of data

Tests on image data Generic Tests: Generic Tests: Check output is of correct datatype Check output is of correct datatype Check image dimensions Check image dimensions Specific tests: Specific tests: Depends on application being tested Depends on application being tested For airway tree validation we may want to compare distance between branchpoints For airway tree validation we may want to compare distance between branchpoints For Lung Segmentation we need to compare volumes and/or distance between contours For Lung Segmentation we need to compare volumes and/or distance between contours

Objectives of test framework Different applications: Different applications: Regression testing after any changes Regression testing after any changes Validation of data Validation of data Flexible: Flexible: Testers only plug in specific tests Testers only plug in specific tests Test data generation and reporting of test results taken care by framework Test data generation and reporting of test results taken care by framework

Implementation Built on top of PyUnit : Built on top of PyUnit : Part of standard Python library for Python 2.1 and later Part of standard Python library for Python 2.1 and later Based on JUnit, a proven testing architecture Based on JUnit, a proven testing architecture Allows creation of user defined tests, aggregation into suites, running tests in textual or GUI mode Allows creation of user defined tests, aggregation into suites, running tests in textual or GUI mode

Writing tests with PyUnit:  Basic building blocks called Test Cases  Created by deriving from base class unittest.TestCase  An instance of a TestCase class is an object that can completely run a single test method  Fixtures  A set-up and tear down method for each test case  Many different test cases can use the same fixture  Test Suites  Test case instances can be grouped together according to the features they test  All tests can be executed together as part of a suite  Test Runner  A class whose instances run tests and report results  Can be used in text or GUI mode

Example: class LungSegTestCase(unittest.TestCase): def initialize(self,fname1,fname2): def initialize(self,fname1,fname2): A = AnaFile.AnaFile() # Anafile object for reading images A = AnaFile.AnaFile() # Anafile object for reading images self.data,hdr=A.read(fname1) # segmentation result self.ref_data,ref_hdr = A.read(fname2) # reference mask def setUp(self): def setUp(self): self.labels=[20,30] # left and right lung labels self.labels=[20,30] # left and right lung labels def tearDown(self): def tearDown(self): self.data = None self.data = None self.ref_data= None self.ref_data= None def test1(self):## test method names begin 'test*' def test1(self):## test method names begin 'test*' """Test to see if mask image datatype is uint8.""" """Test to see if mask image datatype is uint8.""" self.assertEquals(self.data.typecode(),'b') self.assertEquals(self.data.typecode(),'b') def test2(self): def test2(self): """Test to check that correct labels are present in mask file.""" """Test to check that correct labels are present in mask file.""" for n in self.labels: for n in self.labels: errormsg="label" + str(n) + "missing" errormsg="label" + str(n) + "missing" self.assertNotEquals(sum(ravel(equal(self.data, n))),0,errormsg) self.assertNotEquals(sum(ravel(equal(self.data, n))),0,errormsg)

Example: class LungSegTestCase(unittest.TestCase): def initialize(self,fname1,fname2): def initialize(self,fname1,fname2): A = AnaFile.AnaFile() # Anafile object for reading images A = AnaFile.AnaFile() # Anafile object for reading images self.data,hdr=A.read(fname1) # segmentation result self.ref_data,ref_hdr = A.read(fname2) # reference mask def setUp(self): def setUp(self): self.labels=[20,30] # left and right lung labels self.labels=[20,30] # left and right lung labels def tearDown(self): def tearDown(self): self.data = None self.data = None self.ref_data= None self.ref_data= None def test1(self):## test method names begin 'test*' def test1(self):## test method names begin 'test*' """Test to see if mask image datatype is uint8.""" """Test to see if mask image datatype is uint8.""" self.assertEquals(self.data.typecode(),'b') self.assertEquals(self.data.typecode(),'b') def test2(self): def test2(self): """Test to check that correct labels are present in mask file.""" """Test to check that correct labels are present in mask file.""" for n in self.labels: for n in self.labels: errormsg="label" + str(n) + "missing" errormsg="label" + str(n) + "missing" self.assertNotEquals(sum(ravel(equal(self.data, n))),0,errormsg) self.assertNotEquals(sum(ravel(equal(self.data, n))),0,errormsg)

Example: class LungSegTestCase(unittest.TestCase): def initialize(self,fname1,fname2): def initialize(self,fname1,fname2): A = AnaFile.AnaFile() # Anafile object for reading images A = AnaFile.AnaFile() # Anafile object for reading images self.data,hdr=A.read(fname1) # segmentation result self.ref_data,ref_hdr = A.read(fname2) # reference mask def setUp(self): def setUp(self): self.labels=[20,30] # left and right lung labels self.labels=[20,30] # left and right lung labels def tearDown(self): def tearDown(self): self.data = None self.data = None self.ref_data= None self.ref_data= None def test1(self):## test method names begin 'test*' def test1(self):## test method names begin 'test*' """Test to see if mask image datatype is uint8.""" """Test to see if mask image datatype is uint8.""" self.assertEquals(self.data.typecode(),'b') self.assertEquals(self.data.typecode(),'b') def test2(self): def test2(self): """Test to check that correct labels are present in mask file.""" """Test to check that correct labels are present in mask file.""" for n in self.labels: for n in self.labels: errormsg="label" + str(n) + "missing" errormsg="label" + str(n) + "missing" self.assertNotEquals(sum(ravel(equal(self.data, n))),0,errormsg) self.assertNotEquals(sum(ravel(equal(self.data, n))),0,errormsg)

Application dependent tests: For lung segmentation we use an area overlap measure to test correctness: For lung segmentation we use an area overlap measure to test correctness: Check that value is above a given threshold to 'pass' test Check that value is above a given threshold to 'pass' test Similar tests can be defined with distance measures between contours Similar tests can be defined with distance measures between contours User has to plug-in appropriate tests User has to plug-in appropriate tests

Flow diagram:

Sample configuration file: [DEFAULT] # Directory of gold-standard data Refdir =../ValidationData #Directory of data generated by algorithm Maskdir =../NewData # Output file extension MaskExt = mask.img # Name of logfile directory Logdir =../logfiles [ALGORITHM] # Dir. of raw image data to run algorithm on Inputdir = /home/xyz/lung/Data # Path to executable for algorithm Execpath =../lung # Input file extension InputExt = img

Reporting test results: Textual output directed to log files Textual output directed to log filesSuccess: Ran 6 tests in s OKFailure: FAIL: Left lung pixel count test (slice by slice) Traceback (most recent call last): File "lungsegtests.py", line 101, in test6 File "lungsegtests.py", line 101, in test6 self.failIf(fail==1,errormsg) self.failIf(fail==1,errormsg) File "unittest.py", line 264, in failIf File "unittest.py", line 264, in failIf if expr: raise self.failureException, msg if expr: raise self.failureException, msg AssertionError: significant segmentation mismatch for left lung on slices: [458, 462]

Status: Testing for Lung segmentation/smoothing has been implemented with the following tests: Testing for Lung segmentation/smoothing has been implemented with the following tests: Type checking of output masks Type checking of output masks Checking that all expected labels are present Checking that all expected labels are present Slice by slice area comparison for both lungs Slice by slice area comparison for both lungs Can be used by segmentation algorithms on ANALYZE images which produce labeled masks Can be used by segmentation algorithms on ANALYZE images which produce labeled masks Framework can be extended to handle other formats like airway tree definitions etc Framework can be extended to handle other formats like airway tree definitions etc

References: References: Documentation and source code: CVS repository: pulmonary/TestFrameWork