Presentation is loading. Please wait.

Presentation is loading. Please wait.

Equivalence Partitioning Identify the inputs, behaviors, or other factors that you want to test based on the functionality and specifications Group these.

Similar presentations


Presentation on theme: "Equivalence Partitioning Identify the inputs, behaviors, or other factors that you want to test based on the functionality and specifications Group these."— Presentation transcript:

1 Equivalence Partitioning Identify the inputs, behaviors, or other factors that you want to test based on the functionality and specifications Group these factors into classes that your program should handle in the same way Create test cases with at least one set of data to test each equivalence partition – Boundary values are most likely to identify errors

2 White Box Testing Examine the code and create test cases that – ensure that all paths are tested – Ensure that all conditions are tested Boundary conditions are most likely to identify errors

3 Unit Testing with MsTest Test fixture : a class that contains one or more test methods Test method : a method that executes a specific test Test runner : an application that finds and executes test methods on test fixtures Assertion : a Boolean expression that describes what must be true when some action has been executed

4 [TestMethod()] [ExpectedException(typeof(ArgumentException))] public void BankAccountConstructorTestForNullName () { string name = null; double amount = 1.00; BankAccount acct = new BankAccount(name, amount); // Exception is expected because name is null } Handling Expected Exceptions

5 [TestMethod] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\DepositTestData.csv", "DepositTestData#csv", DataAccessMethod.Sequential), DeploymentItem("BankAccountTests\\DepositTestData.csv")] public void TestDepositGreaterThanZero () { double initialBalance = Convert.ToDouble(TestContext.DataRow[0]); double amountDeposited = Convert.ToDouble(TestContext.DataRow[1]); double expected = Convert.ToDouble(TestContext.DataRow[2]); BankAccount acct = new BankAccount("Ed Gellenbeck", initialBalance); acct.Deposit(amountDeposited); Assert.AreEqual(expected, acct.Balance); } Data Driven Unit Tests

6 Red/Green/Refactor Test Driven Development 1.Write the test code 2.Compile the test code (It should fail because you haven’t implemented anything yet.) 3.Implement just enough to compile. 4.Run the test and see it fail. 5.Implement just enough to make the test pass. 6.Run the test and see it pass. 7.Refactor for clarity and to eliminate duplication. 8.Repeat from the top.

7 Benefits of Unit Testing Act of writing tests often uncovers design or implementation problems Unit tests serves as documentation Unit tests aid regression testing Unit tests easily migrate to maintenance and future enhancements

8 Integration Testing Integration is the process of combining components (e.g. classes) to create a larger component Integration testing focuses on finding interface errors between unit-tested components Integration testing should begin as soon as components have been unit-tested

9 System Testing

10 System testing involves running the entire system on the actual hardware – Function testing: does the integrated system perform as promised by the requirements specification? – Performance testing: are the non-functional requirements met? – Acceptance testing: is the system what the customer expects? – Installation testing: does the system run at the customer site(s)?

11 Short Answer Question How does system testing differ from unit and integration testing? How does unit testing differ from integration testing?

12 In a method, a variable did not get initialized properly. Which type of testing would most likely expose this defect? A. Unit testing B. Integration testing C. Functional testing D. Performance testing E. Acceptance testing F. Installation testing

13 A gas pump system is supposed to allow the user to choose whether or not a receipt is printed, but the print function has not been implemented. Which type of testing is most likely to expose this defect? A. Unit testing B. Integration testing C. Functional testing D. Performance testing E. Acceptance testing F. Installation testing

14 A configuration file used by the reporting subsystem is not placed in the correct directory in the customer's environment. Which type of testing is most likely to expose this defect? A. Unit testing B. Integration testing C. Functional testing D. Performance testing E. Acceptance testing F. Installation testing

15 The customer is unhappy with the number of screens that must be traversed before getting to the parts list screen, a screen accessed frequently when using the system. Which type of testing is most likely to expose this defect? A. Unit testing B. Integration testing C. Functional testing D. Performance testing E. Acceptance testing F. Installation testing


Download ppt "Equivalence Partitioning Identify the inputs, behaviors, or other factors that you want to test based on the functionality and specifications Group these."

Similar presentations


Ads by Google