Miniprofiler and QUnit are simple DLL, JS and CSS files that can be added to an ASP.MVC project to identify trouble spots in a project such as server side functions that run longer than anticipated or intermittent JS errors/warnings that show up in browsers' consoles.
Miniprofiler - keeps track of the amount of time functions in an ASP.MVC source code take to execute and displays the results on a browser. I have found that functions that take longer to execute are good candidates for refactoring.
To add Miniprofiler:
More information about Miniprofiler
QUnit - is a JS unit testing tool that provides a collection of functions that can be used for JS unit tests. In addition to unit test functions, QUnit also displays JS error messages in formatted panel on a browser.
To add QUnit:
More information on QUnit
With Miniprofiler and qUnit libraries your ASP.MVC project now has simple but yet powerfull tools for troubleshotting trouble spots and optimizing performance for an ASP.MVC application.
Miniprofiler - keeps track of the amount of time functions in an ASP.MVC source code take to execute and displays the results on a browser. I have found that functions that take longer to execute are good candidates for refactoring.
To add Miniprofiler:
- Use Package Manager to add references to Miniprofiler in your project
PM> Install-Package MiniProfiler
- Update Global.asax file as follows (this is for making the library available globally in your project)
using StackExchange.Profiling;
and
protected void Application_BeginRequest() { if (Request.IsLocal) { MiniProfiler.Start(); } } protected void Application_EndRequest() { MiniProfiler.Stop(); }
- Add the following one line code to the_layout file (for razor) or master for (for form viewengine)
if (Request.IsLocal) { @StackExchange.Profiling.MiniProfiler.RenderIncludes() }
Miniprofiler
More information about Miniprofiler
QUnit - is a JS unit testing tool that provides a collection of functions that can be used for JS unit tests. In addition to unit test functions, QUnit also displays JS error messages in formatted panel on a browser.
To add QUnit:
- Copy the latest JS and CSS for QUnit from http://qunitjs.com/ locally.
(It might be a good idea to isolate the libraraies in a separate "Test" folder, in case there is a bundling routine for minifying JS and CSS files) - Add reference to the CSS and JS files on your _layout file (for razor) or master for (for form)
- Add error container rendering div's in the _layout file (for razor) or master for (for form)
<div id="qunit"></div> <div id="qunit-fixture"></div>
QUnit
More information on QUnit
With Miniprofiler and qUnit libraries your ASP.MVC project now has simple but yet powerfull tools for troubleshotting trouble spots and optimizing performance for an ASP.MVC application.
Comments