The Q3 2013 version of JustCode has been released and is available! The latest version of JustCode has a lot of great new features. In this post I’m going to tell you about some of the exciting new features in this tool and how they can help you start writing better code today! And if you’re using the Visual Studio 2013 don’t worry; JustCode supports 2013 so these great features available to all the early adopters out there.

Cyclomatic Complexity Indicator

There are many metrics developers use to measure the quality of their code. One of the most popular is cyclomatic complexity. Cyclomatic complexity (CC) is the number of unique paths that can be executed in a method. If you don’t understand this now, don’t worry; I’ll be writing a more detailed post about this metric and how it impacts your code in the near future.

JustCode will analyze your code and show you the CC number near the top of your method. You can enable this in the JustCode Options Dialog (JustCode –> Options… –> Code Metrics) (Figure 1):

image

Figure 1 – A partial view of the Code Metrics page in the JustCode Options dialog

To start having JustCode display the CC for your code simply check the “Enable Cyclomatic Complexity” checkbox. I also have the ability to decide where the indicator will be shown in Visual Studio. I can also get a preview giving me an idea of how the CC metric will look, making it easier for me to decide where I want the metric to go. If I select “Left of the unit” and click “Save” I can see the CC number next to my method declaration (Figure 2):

image

Figure 2 – The CC number in Visual Studio

Code and File Templates

JustCode already has an impressive templating language that enables developers to quickly automate many simple coding chores enabling them to focus on the important parts of the code. With the Q3 2013 release, JustCode has added the ability to add a description to our custom template as well as the ability to define a scope for the template to execute in. In Figure 3 you can see the I’ve opened the “Insert Mock” template in the Edit Code Template dialog (JustCode –> Options… –> Code Templates –> C# –> select the “Insert Mock” template and click “Edit”):

image

Figure 3 – The Edit Code Template dialog

This code template is activated with the acronym “cm” and has a description of “Insert mock.” This will help you understand what your template does when the acronym is not clear and without having to examine the template test to try to understand what it does. I’m also able to specify a scope or “availability.” In this case the template will only be available inside of a member body in a C# class. If I tried to use this in a JavaScript file, it would not be available. I also have the ability to specify descriptions and a content language in file templates (Figure 4):

image

Figure 4 – The Edit File Template dialog

In this example I’m creating a C# class. The content language is set to C#, which prevents this template from being used somewhere that would not be appropriate, like a VB.NET project.

Test Runner Enhancements

The JustCode test runner has been improved in this release as well. In addition to being faster, the JustCode test runner allows you to navigate straight from the stack trace to your code for failed tests. For example, in Figure 5 you can see that I have a failing test:

image

Figure 5 – A failing test

In the details pane, after the “Error Message” section you can see the stack trace. Just by looking you can probably see that every class name, method name and file location is clickable. Clicking these takes me to the definition or location indicated. If I click on TddStore.Core.OrderService, it takes me to the definition of the OrderService class. If I click on the PlaceOrder method it takes me to the top of the PlaceOrder method. If I click on one of the file locations, it takes me to that specific location. For example, if I click that last item in the stack, which points to line 39 in the OrderServiceTests.cs file, it takes me to that line in that file (Figure 6:)

image

Figure 6 – The stack trace takes me to the location.

This new features makes tracking down the cause of failing tests much easier since we can navigate directly to the line of code causing the problem. This is a great benefit and a big time saver for those of practicing TDD!

Integration with JustMock

On its own JustCode is a great productivity enhancer. But when paired with Telerik’s JustMock mocking framework for Test Driven Development your productivity will get an even greater boost! JustCode adds some code generation abilities based on JustMock that will get your mocks arranged in no time.

With one simple JustCode action I can go from my declaration… (Figure 7)

image

Figure 7 – Declaration of my mocked interface

… to a fully arranged mock (Figure 8):

image 

Figure 8 – My arranged mock

JustCode integration made arranging this mock as easy as bringing up the JustCode Visual Aid menu hotkey (Alt + End) and then selection “Arrange Mock” (Figure 9)

image

Figure 9 – JustCode JustMock integration

You have the ability to fully arrange a mock as I’ve shown (just plug in your values) or simple declare the mock and arrange it yourself.

Summary

Every quarter the JustCode team works hard to bring new and exciting features to the product and Q3 2013 is no exception. This post has just touched on some of the great new things in the new release of JustCode and upcoming posts will dive into these features in more detail and show you how to use JustCode to make your development lightning fast. If you’re not already a proud JustCode owner, download the demo and see what you’ve been missing!

JustCode download banner image
About the Author

James Bender

is a Developer and has been involved in software development and architecture for almost 20 years. He has built everything from small, single-user applications to Enterprise-scale, multi-user systems. His specialties are .NET development and architecture, TDD, Web Development, cloud computing, and agile development methodologies. James is a Microsoft MVP and the author of two books; "Professional Test Driven Development with C#" which was released in May of 2011 and "Windows 8 Apps with HTML5 and JavaScript" which will be available soon. James has a blog at JamesCBender.com and his Twitter ID is @JamesBender. Google Profile

Comments

Comments are disabled in preview mode.