C C T B H P N

Lecture #18 - Test Harness

Loads DLLs into AppDomains for Testing

Web Resources:

UML XML, HTML Code Project Microsoft Developer's Network DevelopMentor XML Sells Brothers Windows Developer's Journal WindowsClient.net DotNetJunkies dotnet quickstart tutorials C# Corner Mono Project Performance Counters

Content:

This lecture is concerned Test Harnesses and with Common Language Runtime (CLR) related topics.
  1. The Syllabus describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
  2. Projects:

  3. Project #4 Demos:

    • CsMessagePassingComm
      This is close to everything you need for Project #4. You may have to make a few minor modifications, but nothing very significant.
    • NavigatorClientAndServer
      Demo of a WPF GUI that supports navigating through files and directories, both locally and in a remote server. It uses the Message-Passing Comm system from the previous demo, with very few changes. Look at message dispatching in both server and client.
    • SpawnProc
      Illustrates how to create multiple child processes, using the .Net Process class. This will allow you to use your Project #3 - Code Analyzer with no modifications for Project #4. We will discuss this in class.
    • GUI Test
      Shows how to run requirements testing on startup. Note that your run.bat file will be run in a Developer's Command Prompt with administrator previledges.
    • Mediator based Dispatcher: Mediator-based Communicators
      Class Diagram, Object Diagram
      This flexible design for server functionality is more than needed for Project #4.
  4. Testing:

    Project2-InstrSol uses single-user test harness
    Single-user Test Harness used to test and demonstrate Instructor's Solution for Project #2. C# Dynamic Link Libraries (DLLs), C++ Dynamic Link Libraries (DLLs)
    Shows how to load dynamic link libraries into a process either implicitly or explicitly. Application Domains, pptx, Creating AppDomains Demo
    .Net libraries cannot be unloaded from a process.
    The only way to unload libraries is to load them into a child AppDomain,
    and unload the child AppDomain when finished with the libraries. C# TestHarness Prototype - Fall 2017
    Shows how C# libraries can be tested in a TestHarness. Look carefully at TestConfigure.cs
    Test Harness Prototype - Block Diagram, vsdx
    Test Harness - Class Diagram, vsdx
    Test Harness - Structure Chart, vsdx
    TestHarness - Instr Sol, F2016, Activity and Class diagrams
    This shows one way to demonstrate requirements with logging.
    The following was used in previous semesters. Simplified Test Harness (no Child AppDomain) - code C++ Testing Demo
    Shows how C++ libraries can be tested in a TestHarness.

    Types of Testing:

    Construction Tests:
    • Purpose: Support building functioning packages
    • Method: Include guarded main function. As each method in the package is constructed one or more tests are created and run in the main function. This should lead to a style of development where every few lines of code are compiled and tested before adding more code. So there is a continuing sequence of adding a little code, building, and running to make sure the code is always functional. This should start very early in the coding phase.
    Unit Tests:
    • Purpose: Verify Correctness
    • Method: Detailed inspection and debugger walkthrough of every line of code, toggeling predicates, inspecting data, and exploring "corner" cases. This is a very expensive test and isn't applied to every package, but is applied to packages with many dependent parent packages.
    Integration Tests:
    • Purpose: To ensure that large software parts - subsystems - get assembled correctly.
    • Method: Assemble parts, usually in some form of test harness, build and run. Check that all data flows are as expected, that messages and notifications are issued at appropriate times, that exception handling works as expected. Essentially we run Integration Tests to ensure that the software cycles as it should.
    Regression Tests:
    • Purpose: Perform fairly quick test of an entire baseline.
    • Method: Build a detailed set of low, mid, and high-level tests that are run in sequence to give quick confirmation that code additions and changes in platform have not broken any of the parts.
    Stress Tests:
    • Purpose: Ensure that the system does not crash or behave erratically when tested against very large loads. The system may not be expected to meet specifications under huge loads, but it should recover and operate as specified when the load returns to the specified range.
    • Method: Design tests that are CPU intensive, read/write intensive, involve a lot of data transfer, may block waiting for resources, etc. Run multiple concurrent clients against server measuring throughput and latency.
    Qualification Tests:
    • Purpose: Verify that the development has met its obligations. This is a "delivery" test.
    • Method: Run a large suite of requirements tests - one or more for each requirement (usually hundreds). This is a very long process and needs to be automated. The customer and development team should examine each requirement, look at the code that implements the requirement, and examine recorded and live data that demonstrates the requirement is met.
  5. CLR Related Topics

  6. An interesting tool: