Earn Higher Grades With Instant Assignment Help.Ask Question!

Software Engineering
(5/5)

Source code for unit testing is created to think like scientific calculator. Unit testing allows the programmer to refactor code at a later date, and make sure the module still works correctly.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Software Testing Prof. Othoniel Rodriguez

Introduction

Unit Testing validates that each unit of the software performs as designed. A unit is the smallest testable part of any software. It usually has one or a few inputs and usually a single output. We test software to manage risk. Risk is the potential for a problem to be realized. A lower level of risk implies fewer problems. Poorly written code is like ice on the sidewalk, you walk on it you’re likely to fall. It may not exhibit any problems. However, when the right set of inputs sends execution down the path with the ice-like code, a problem may occur. A dry, safe sidewalk is useless for us to travel on if it will not lead us to our intended destination. The purpose and intention of a unit test for every role even tangentially is related to the development of software, for the importance and value of automating the software validation process. There is no doubt the Agile Programming methodologies have contributed to the increase of awareness, content and focus of unit tests. The passion and zeal developers gain for these processes is not surprising. Many of these methodologies make our lives easier, our jobs become more enjoyable. Unit testing is such a broad subject that multiple books are required to properly cover the topic. I have chosen to focus only on the intended purpose of software unit tests. I wanted to clarify many of the misconceptions associated with unit tests. Quality control should exist at many levels in the development process. It is very important for everyone in the development process to understand that unit tests alone are not enough to verify the final product. Moreover, having a sufficient set of unit tests in place should significantly reduce the amount of time required to verify and release the final product.

Description of Application

Source code for unit testing is created to think like scientific calculator. Unit testing allows the programmer to refactor code at a later date, and make sure the module still works correctly. The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified and fixed. Due to the modular nature of the unit testing, we can test parts of the project without waiting for others to be completed. To illustrate how to implement unit testing and automate testing process, I have built a small project. At each stage of the project development we will write tests to check a particular unit’s design and functionality. These tests will be implemented in the MoneyTest class and then we will configure it for unit testing. Then if the unit testing functions work successfully, then we will run a couple of integration tests to make sure we did unit testing the right way.

Techniques Studied in Class

Unit Testing

Is a component of test-driven development (TDD), a pragmatic methodology that takes a meticulous approach to building a product by means of continual testing and revision. Test-driven development requires that developers first write failing unit tests. Then they write code and refactor the application until the test passes. TDD typically results in an explicit and predictable code base.. Unit testing involves only those characteristics that are vital to the performance of the unit under test. This encourages developers to modify the source code without immediate concerns about how such changes might affect the functioning of other units or the program as a whole. Once all of the units in a program have been found to be working in the most efficient and error-free manner possible, larger components of the program can be evaluated by means of integration testing. Unit testing does have steep learning curve. The development team needs to learn what unit testing is, how to unit test, what to unit test and how to use automated software tools to facilitate the process on an on-going basis. The great benefit to unit testing is that the earlier a problem is identified, the fewer compound errors occur. A compound error is one that doesn't seem to break anything at first, but eventually conflicts with something down the line and results in a problem.

Integration Testing

Is a level of software testing where individual units are combined and tested as a group. The purpose of this level of testing is to expose faults in  the interaction between integrated  units. Test drivers and test stubs are used to assist in Integration Testing. A software development process which program units are combined and tested as groups in multiple ways. In this context, a unit is defined as the smallest testable part of an application. Integration testing can expose problems with the interfaces among program components before trouble occurs in real-world program execution. Integration testing is a component of Extreme Programming(XP), a pragmatic method of software development that takes a meticulous approach to building a product by means of continual testing and revision.

Description and coding of Unit Test Cases

Function #1: BagMultiply is simply where we take two vectors divided in “CHF” and “USD” where we multiply values with the ones in the array, then compares.

Function #2: BagNegate is simply where we take a two vectors divided in “CHF” and “USD” where we multiply negative sign with values in the array, then compares.

Function #3: BagSimpleAdd is simply where we take two vectors divided in “CHF” and “USD” where we add to the values in the array respectively one column at a time, then compares.

Function #4: BagSubstract is simply where we take two vectors divided in “CHF” and “USD” where we subtract to the values in the array respectively, then compares.

Function #5: BagSumAdd is simply where we take two vectors divided in “CHF” and “USD” where we add to the values in the array respectively two columns at once, then compares.

Function #6: IsZero simply returns a boolean value whether a value is cero or not.

Function #7: MixedSimpleAdd is simply where we take two vectors divided in “CHF” and “USD” and we add to the values in the array respectively one column at a time, then compares.

Function #8: MoneyBagEquals is simply where we compare two values to see if they are the same.

Function #9: MoneyEquals is the same as function #8 but this time we’re testing the Equals method itself.

Function #10: MoneyHash, like the name suggests simply we get the hash code of a singular value. The hash code is a numeric value which helps in identification of an object during equality testing and also can serve as an index for the object.

Function #11, 12, 13 and 14: Normalize1, 2. 3 and 4, like the name suggests to normalize the values in the bag. The intention is that these normalized values allow the comparison of corresponding normalized values for different datasets in a way that eliminates the effects of certain gross influences. Then compares.

Function #15: Print, simply shows the selected value.

Function #16: SimpleAdd, does a simple arithmetic function of adding two values. Then compares. Function #17: SimpleBagAdd, adding values to two vectors one at a time. Then compares.

Function #18: SimpleMultiply, just multiply values in the vector. Then compares.

Function #19: SimpleNegate, turns positive values into negative ones and the other way around. Then compares.

Function #20: SimpleSubtract, just subtract to the values in the vector. Then compares.

Description and coding of Integration test cases

Integration Test #1: I used Function #16 and Function #20, where I added a value then I subtracted it, then comparing the final result to the initial value.

Integration Test #2: I used Function #16 and Function #18, where I multiplied the initial value by cero then I added the same as the initial value, then comparing the final result to the initial value.

Integration Test #3: I used Function #18 and Function #20, where I multiplied a value then I subtracted it, then comparing the final result to the initial value.

Integration Test #4: I used Function #3 and Function #4, where I added to the initial value, then I subtracted the same inital value, then comparing the final result to the initial value.

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
612 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
773 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
859 Answers Hire Me