The flashcards below were created by user mateotete on FreezingBlue Flashcards.

  1. 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.
  2. 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.
  3. 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
  4. 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)


    • [TestClass]
    • public class CalculatorTest
    • {
    •    [TestMethod]
    •    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);
    •    }
    • }
  5. What are some common Assert methods?
    • Assert.AreEqual()
    • Assert.AreNotEqual()
    • Assert.AreSame()
    • Assert.AreEquivalent()
    • Assert.AllItemsAreUnique()
    • Assert.AllItemsAreInstancesOfType()
    • Assert.Contains()
    • Assert.DoesNotContain()
    • Assert.IsNull()
    • Assert.IsInstanceOfType()
    • Assert.StartsWith()
    • Assert.Matches()
  6. 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");
Card Set:
2017-11-08 11:31:00
StudyMaterial UnitTesting

Describes how to unit test using MSTest in an MVC project.
Show Answers: