Diagnostix is a DotNetNuke module that executes .Net Assemblies that may test specific features of DotNetNuke or modules that you have installed. Some of these Diagnostix Tests can also change the configuration of your site and process data in background threads (An example of this is the Axon POP3 Processing Test for Diagnostix).
Diagnostix includes several Tests and you can also add new Tests to your site at any time. You can download new Diagnostix Tests from www.OnyakTech.com or you can build your own.
Win a FREE OnyakTech 1 Year Subscription - Submit your Diagnostix Tests to Sales@OnyakTech.com and if we include your test into the next release of Diagnostix you will be given a free one year subscription. If you are already member then we will add an additional year to your account!
History - Diagnostix was originally developed in early 2010 to help trouble-shoot and unit test OnyakTech modules. The possibility of uses for Diagnostix Tests are vast and other developers have developed powerful Tests for many types of solutions. Now that Diagnostix is now available for FREE we hope to collect some of these Tests and make them available to you for use in your own web sites. If you develop a Diagnostix Test please share it with the community by submitting it to Sales@OnyakTech.com for inclusion into the next release of Diagnostix. Enjoy!
Sample Diagnostix Test Run
Sample Diagnostix Test: Web Site Speed
The following is the C# Source Code for the Web Site Speed Test that is included with Diagnostix version 1.0.
// C# source code for Diagnostix
// Created by Chris Onyak, OnyakTech LLC - www.OnyakTech.com - Sales@OnyakTech.com
using DotNetNuke.Entities.Users;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Reflection;
using OnyakTech.Diagnostix.Utilities;
using System.Web;
using DotNetNuke.Entities.Portals;
namespace OnyakTech.Diagnostix.Tests
{
public class WebSiteSpeedAnalysis : Interfaces.ITest
{
#region Properties
public PortalSettings PortSettings { get; set; }
public HttpContext CurrentWebContext { get; set; }
public ActivityLog Log { get; set; }
public string Author { get; set; }
public string AuthorWebSite { get; set; }
public string Version { get; set; }
public string TestName { get; set; }
public string TestRestults { get; set; }
public string Notes { get; set; }
public int ModuleId { get; set; }
public int PortalId { get; set; }
public int UserID { get; set; }
public int TabID { get; set; }
public bool HasNotes { get; set; }
#endregion
public void Init()
{
// Populate Test Properties
this.Author = "Chris Onyak";
this.AuthorWebSite = "http://www.OnyakTech.com";
this.Version = Utilities.Common.GENERAL_VERSION;
this.TestName = "Web Site Performance Analysis";
this.HasNotes = true;
this.Notes = "Displays metrics about the performance of your web site.";
}
public void BeforeRunTests()
{
}
public bool RunTest()
{
bool retval = true;
HttpWebRequest request;
HttpWebResponse response = default(HttpWebResponse);
try
{
DateTime timeStamp = DateTime.Now;
request = (HttpWebRequest)WebRequest.Create(CurrentWebContext.Request.Url);
response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
TimeSpan ts = DateTime.Now - timeStamp;
Log.Add(string.Format("Site Response Time: {0} seconds", (ts.TotalMilliseconds / 1000).ToString()), false);
// DNN Metrics
Log.Add(string.Format("Portal Name: {0}", PortSettings.PortalName), false);
Log.Add(string.Format("Total Registered Users: {0}", UserController.GetUserCountByPortal(PortalId).ToString()), false);
Log.Add(string.Format("Administrative Email: {0}", PortSettings.Email), false);
Log.Add(string.Format("Portal Expiration Date: {0}", PortSettings.ExpiryDate), false);
Log.Add(string.Format("Portal Globally Unique Identifier: {0}", PortSettings.GUID), false);
Log.Add(string.Format("Pages: {0}", PortSettings.Pages.ToString()), false);
Log.Add(string.Format("Portal Version: {0}", PortSettings.Version), false);
}
else
{
retval = false;
Log.Add("Failed to Test Site", false);
}
}
catch (Exception ex)
{
retval = false;
Log.Add(ex.Message, true);
}
finally
{
response.Close();
}
return retval;
}
public void AfterRunTests()
{
}
}
}