logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Kaleb BryanttManagement
(5/5)

837 Answers

Hire Me
expert
Sahil SachdevaComputer science
(5/5)

845 Answers

Hire Me
expert
Bhupesh SinglaComputer science
(5/5)

666 Answers

Hire Me
expert
Roger BrodieResume writing
(5/5)

669 Answers

Hire Me
Software Engineering

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.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. 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

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme