2.
Quality Challenges “ Software bugs, or errors, are so prevalent and so detrimental that they cost the U.S. economy an estimated $59.5 billion annually, or about 0.6 percent of the gross domestic product…an estimated $22.2 billion, could be eliminated by an improved testing infrastructure that enables earlier and more effective identification and removal of software defects.” (Source: NIST 2002) Satisfying users Business interruption risks Ongoing maintenance costs rising Less avail. resources

6.
Unit Test Types <ul><li>Class (standard) </li></ul><ul><ul><li>Test the properties and methods of a class </li></ul></ul><ul><li>Data-driven </li></ul><ul><ul><li>Bind unit test parameters to a datasource </li></ul></ul><ul><li>ASP.NET </li></ul><ul><ul><li>Test classes (or business logic) inside an ASP.NET application </li></ul></ul><ul><ul><li>Run in the context of the web server (ASP objects available) </li></ul></ul><ul><li>Web Services </li></ul><ul><ul><li>Define a web reference to the service </li></ul></ul>

7.
Extensions of Unit Testing <ul><li>Regression Testing </li></ul><ul><ul><li>Modifications are validated with regression tests </li></ul></ul><ul><ul><li>Write new code and verify system continues to function correctly </li></ul></ul><ul><li>Integration Testing </li></ul><ul><ul><li>Helps validate how tested components interact with one another </li></ul></ul><ul><ul><li>Can identify problems that occur when units are combined </li></ul></ul><ul><li>Scenario Testing </li></ul><ul><ul><li>Combine sequence of unit tests to cover a scenario </li></ul></ul>

8.
Writing Effective Unit Tests <ul><li>Atomic </li></ul><ul><ul><li>Should not require others tests to be run first </li></ul></ul><ul><li>Cover all cases </li></ul><ul><ul><li>One test for each sceneario </li></ul></ul><ul><ul><li>Cover all conditions, exceptions, nulls, etc. </li></ul></ul><ul><li>Able to re-run without configuration </li></ul><ul><ul><li>Database create/read/update/delete without having to modify the database before or after the test is run </li></ul></ul><ul><li>Test a common application state </li></ul>Unit tests should be …

10.
Creating Unit Tests (1 of 2) <ul><li>Attributes are used to denote which methods and classes should be loaded for tests </li></ul><ul><ul><li>TestClass – denotes a class for testing </li></ul></ul><ul><ul><li>TestMethod – denotes a method for testing </li></ul></ul><ul><ul><ul><li>must return void (Sub for VB.NET) and have no parameters </li></ul></ul></ul><ul><li>Certain attributes are associated with initialization </li></ul><ul><ul><li>TestInitialize – run before each test </li></ul></ul><ul><ul><li>TestCleanup – run after each test </li></ul></ul><ul><ul><li>ClassInitialize – run once before running any tests in the class </li></ul></ul><ul><ul><li>ClassCleanup – run once after running all tests in the class </li></ul></ul><ul><li>Assert – static type used for asserting test values </li></ul><ul><li>ExpectedException – attribute used for determining the exception that should be thrown from the test </li></ul>

13.
Code Coverage <ul><li>Improves effectiveness of tests </li></ul><ul><li>Show a measurable indication of code that was covered by unit tests </li></ul><ul><ul><li>Strive for 75% and higher </li></ul></ul><ul><li>Shows the ratio of executed logic to the total logic </li></ul><ul><li>Can be used in conjunction with unit and load testing </li></ul><ul><li>Helps to find unused code </li></ul>Determine code that is exercised by tests

19.
Load Testing <ul><li>Load Testing: ensure application works under expected, concurrent user load </li></ul><ul><li>Create test cases that simulate real user conditions </li></ul><ul><li>Distribute tests across cases based on user behavior </li></ul><ul><li>Assume standard think times </li></ul><ul><li>Distribute across connection types </li></ul><ul><li>Simulate an application performance in a production environment </li></ul><ul><li>Provide repository to look at a performance trend over time, to see if changes are helping or hurting </li></ul>Simulate multiple users against an application simultaneously

23.
Manual Test <ul><li>Tracked like other tests when executing test groups </li></ul><ul><li>Presented to the tester to enter and confirm results </li></ul><ul><li>Defined as text file or Word document </li></ul>

24.
Generic Test <ul><li>Wrap existing code and have that code executed as part of the testing process </li></ul><ul><li>Centralized results of all tests </li></ul>

25.
Ordered Test <ul><li>Test to group (and order) other tests </li></ul><ul><li>Results of ordered tests either succeed or fail as a group </li></ul><ul><li>Used for scenario and module-level testing </li></ul><ul><li>Add any test except a load test to an ordered test </li></ul>

29.
The Test Lab Database <ul><li>Run against a test version of the database </li></ul><ul><li>Test data should be same nature and size as production </li></ul><ul><li>Test a steady state of the database </li></ul><ul><li>Automate the initialization of the database </li></ul><ul><li>Extract data using rules to obfuscate personal information </li></ul><ul><ul><li>Visual Studio Database Developer </li></ul></ul>