This project is read-only.
Creating New Tasks

There are currently two choices for creating new/custom tasks:
  1. You can utilize the ExecTask to run a custom console application that includes the custom logic required and returns the pass/fail status via the Exit Code.
  2. You can modify the NDiagnostics source code and create a new, built-in task for your needs.

Using the ExecTask

Making use of the ExecTask requires the following steps:
  1. Create a console-based application that performs the desired logic. This application should return a pass/fail code via the application's Exit Code value.
  2. Within your NDiagnostics script file utilize the ExecTask to test for the expected Exit Code.

Modifying the NDiagnostics Source Code

Modifying NDiagnostics requires the following steps:
  1. Create a new class that inherits DiagnosticTask within the NDiagnostics project (external assemblies are not yet supported).
  2. Implement the class' constructor as follows: public ClassName(TaskGroup group, string name, [your customer parameters go here]). The custom parameters should match any properties needed by your task in order to successfully evaluate itself. These arguments will be passed in from the XML configuration file.
  3. Override the Execute method. The Execute method should determine whether or not the task successfully evaluates and return true if the task is successfull and false if the task fails. In either case, set the task's Status property to TaskStatus.Completed if it succeeds or TaskStatus.Error if it fails. In the case of failure, you should also set the task's Message property to a meaningful description of the failure (this will be displayed in the UI next to the failed task).
  4. Modify the GetDiagnosticTask method within the TaskHandler class to include the new task within the switch statement. Add a new case statement for your task and create a new instance passing in the appropriate XML values. NOTE: This step will be removed in a future release once reflection has been implemented).
  5. Recompile NDiagnostics and modify your configuration file(s) accordingly to make use of your new task.
Take a look at the existing tasks to get an idea of how you might want to implement your custom task.

NOTE: In a future release, reflection will be used to instantiate the appropriate task objects which will alleviate the need for step 4 and will also allow for the use of external assemblies. This will greatly simplify the ability to create custom tasks.

Last edited Nov 21, 2007 at 4:09 AM by jbramwell, version 10


No comments yet.