Home > Preview
The flashcards below were created by user
on FreezingBlue Flashcards.
What are the 6 types of common test methodogies used in software development? Describe each.
- Unit: Isolate a piece of code to validate that it performs correctly as a single unit with the unit often being a function, class, or library.
- Integration: Testing done between systems such as two libraries or two classes and how they interact together.
- Regression: Test done to make sure that previous code or code outside this change wasn't broken.
- Acceptance: Tests performed by the actual users to validate that the code works as expected and is useful.
- Smoke/Sanity: Quick and dirty test to see if the unit does what is expected.
- System: Test that the system works on the system it will be deployed on with considerations for memory, speed, file system, permissions, services, connections, and more.
What is Visual Studio Unit Testing Framework?
The Unit Testing Framework describes Microsoft's suite of unit testing tools as integrated into Visual Studio 2005 and later, specifically MSTest. Unit tests created with the unit testing framework can be executed in Visual Studio or, using MSTest.exe, from a command line.
Give a high level 3-step process for writing a Unit Test on a MVC and non-MVC application.
- Both process would be the same and is as follows:
- (1) Create an external application called UnitTests with references to the projects being tested
- (2) Create various classes which represent the page or unit being tested, ie, CalculatorTest
- (3) Create various methods within that class which test each portion of the page or unit being tested--within it, using the 3 A's: Arrange, Act, and Assert
I've written a single web page called Calculator which contains a single function named Divide. Describe in word and code what is needed to properly unit test this function.
(1) Create a new project called UnitTests and reference Calculator project (found under C# | Test | Unit Test Project)
- public class CalculatorTest
- public void Test_Divide()
- // Arrange
- int expected = 5;
- int numerator = 20;
- int denominator = 4;
- // Act
- int actual = Calculator.Library.Calculator.Divide(numerator, denominator);
- // Assert
- Assert.AreEqual(expected, actual);
What are some common Assert methods?
How do you add custom messaging to a unit test method?
Almost all assertions have a parameter for messaging. For example,
Assert.AreEqual(true, fileFound, "The file provided was not created successfully");