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.
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):
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):
Figure 2 – The CC number in Visual Studio
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”):
Figure 3 – The Edit Code Template dialog
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.
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:
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:)
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!
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)
Figure 7 – Declaration of my mocked interface
… to a fully arranged mock (Figure 8):
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)
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.
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!