Telerik blogs

On behalf of Phil and Lohith I want to thank everyone who attended our webinar last Thursday and who will be watching it on Telerik TV in the days and weeks to come. You can find the recording of the webinar here.

What Was Covered

JustCode

There were some great new features added to JustCode in this last quarter! In this webinar I demonstrated the ability to add a description and scope to your code and file templates. Now you can describe your template and you’ll be able to keep track of which ones do what. You can also specify that code in the template is specific to C#, VB, JavaScript, HTML, CSS or LESS! And as if that wasn’t enough you can also decide where your template should run. Does it need to run in a method, or can it run anywhere in a class? What about just in a namespace? You now have control over that.

The JustCode test runner now starts up and runs faster than ever, meaning you can run your tests more often. We’ve also added clickable links for the class and method names in the stack trace (in situations where exceptions are thrown) to navigate directly to the class or method definition. Not specific enough for you? Well, you can also navigate to the specific line in the stack that the exception was thrown on, because that’s a link too! This makes finding a fixing issues in your code faster and more efficient.

Finally I showed that JustCode will now analyze your code and let you know what your cyclomatic complexity is. Cyclomatic complexity is the number of possible unique paths through your code. A high number generally means you have code that has a lot of branches and can be a little too complicated. Now JustCode will tell you what you cyclomatic complexity is in-line with your code. No special tools, nothing to do on your end, JustCode just tells you! Keeping your cyclomatic complexity low helps keep your code readable and easier to maintain.

JustMock

Nothing makes Test Driven Development as easy as the combination of JustCode and JustMock! That’s even truer now that JustCode is able to integrate with JustMock. You start by declaring an instance of the type you want to mock. Then with just a few clicks of the mouse (or taps on the keyboard) JustCode will automatically create your mock for you. And if that’s not enough, JustCode can also stub out arraignments for your mocks. This can be a great time save when mocking type with lots of methods and will get you writing your tests faster!

JustMock has always given you the ability to specify behavior of your mocks by specifying an execution order for your mocked methods or even a number of time that you expect that method to be called. You verify that your mock has been used properly by calling an Assert on the mock at the end of your test. In the Q3 2013 release of JustMock we have improved the workflow by having JustMock inform you immediately if one of these conditions had happened.

With the latest release of JustMock we’ve built better messaging into the Assert method. Now when an Assert on a mock fails you not only get the previously mentioned stack trace with clickable links in the JustCode test runner, you also get much more descriptive messages from JustMock. This will help you find your mock-related problems much more quickly and easily.

JustMock now supports an Introspection API, which enables you to look in the “engine compartment” of your mocking container at runtime and see what’s going on. Now you can see the current arrangements and expectations of your container as well as what the current invocations are when debugging your unit tests. This gives you the ability to see how your test is interacting with your mocking container and know when you aren’t meeting the expectations of your mocks.

Many people are writing .NET applications that are reliant on components that are not based on the .NET framework which they consume via DLL Import. In the past these calls have been very tricky to mock. In the new version of JustMock we make mocking these calls very easy, enabling you to unit test the parts of your application that interact with these components.

Rounding out the new feature list for JustMock is Recursive Loose Mocking. Sometimes, especially in large applications, it’s easy to create an object with a somewhat complex and/or deep dependency tree. Class A is dependent on class B, which is in turn dependent on class C and so on. What if my method under test calls A.B.C.DoStuff(), but I my test doesn’t require a specific arraignment for this? Without recursive loose mocking we would have to create and arrange mocks for all types and methods in this chain. With recursive loose mocking JustMock will create default instances of each dependency that we have not arraigned a mock for and return that value. That means it will create proxies for B and C and return whatever the default value type for DoStuff() is (If it’s Boolean return false, if it’s numeric return zero, etc.). This is a great feature for developers working on large systems with lots of nested dependencies who would rather write meaningful tests and code instead of arranging a bunch of irrelevant dependencies.

JustTrace

JustTrace got some great new features this quarter was well. We’ve always tried to make JustTrace one of the easiest profilers to use. One of the ways we’ve approached this is by taking common types of memory leaks that occur in .NET applications and creating one-click analysis that targets these specific types of leaks. In Q3 2013 we’ve added a new one; Event Handler leaking. When you profile an application in JustTrace it will look for occurrences of leaking event handlers and show them to you with one click. This, and the other analysis types in JustTrace make finding the most common .NET memory leaks quick and easy.

Another new feature that users have been asking for is Source Level Profiling. Source Level Profiling will show you in your code how much time (CPU resources) each line of code is taking. This enables you to quickly find and focus on the specific code in your application that could be causing your performance issues and help take the guess work out of performance profiling.

Most applications don’t just stop with your .NET code. If you’re writing a line of business application you are most likely interacting with some sort of backend data store. This backend data store is usually an SQL database. If you’re writing a web application you’re also dealing with incoming HTTP requests. Either one of these have the potential of effect performance of your application, but now JustTrace will profile these for you and show you how they interact with your code and effect your performance.

JustDecompile

LINQ was a game changer for .NET. Developer love the power this language construct gives them. Now JustDecompile has the power to decompile these queries. In this webinar you’ll see Lohith use JustDecompile to decompile several different examples of complex LINQ syntax quickly and error-free.

VB.NET developers have wanted more support for their language in JustDecompile, and we gave it to them! JustDecompile’s support for Visual Basic .NET has been greatly enhanced. You can now even save your decompiled VB.NET code as a project and use Visual Studio to change and recompile it.

And finally we have added a Visual Studio extension to JustDecompile. This extension makes many of the great features in JustDecompile available inside Visual Studio. Now you no longer have to open another tools to do some of you most common decompiliation tasks; with JustDecompile, it’s all there in Visual Studio for you!

Resources

Phil’s JustMock examples are available at https://github.com/skimedic/JustMockWebinar

The slide deck and the JustTrace demos are available at https://github.com/JamesBender/JustWebinarQ32013

Lohiths LINQ deconstruction example can be found at http://code.msdn.microsoft.com/LINQ-Set-Operators-374f34fe and the VB decompilation was based on demos at

http://msdn.microsoft.com/en-us/vstudio/bb688088.aspx

Questions

As with any webinar we had some great questions form the audience. In case you missed any of them, here they are:

 

Q: Can DLL’s be protected from decompilition?

A: You can obfuscate them, but I don’t know of any means to keep someone out if they really want in.

 

Q: For JustDecompile, what version of VB are you able to decompile? (VB6, VB2005, VB2008, VB 2010, VB2012)

A: You can decompile .NET assemblies, but not VB6

 

Q: How do you get the “X references above” methods? Is that a JustCode thing or Visual Studio edition thing?

A: It’s a Visual Studio 2013 Ultimate feature called Code Lens

 

Q: Show me in JustTrace were I can only have it show me things in MY code… not in OpenAccess.dll, not in Microsofts dlls…literally just my code

A: You can choose which assemblies should be considered your code form the assemblies view in JustTrace more

 

Q: How does JustDecompile compare to other decompilers?

A: First and foremost, JustDecompile is free (now and forever). Beyond that I suggest you compare them side by side. If JustDecompile isn’t better, please let us know!

 

Q:Is there a good document for learning how to use JustDecompile?

A:We have a rich Features webpage which you can use as a starting point for learning how to use JD: http://www.telerik.com/products/decompiler/features.aspx. Also you can review our plug-ins and try them as they're really useful tools as well: http://www.telerik.com/products/decompiler/extensions.aspx

 

Q: What is TDD?

A: Test Driven Development

 

Q: Is there any way for JustMock test runner when it fails due to a null to show you which null value was null instead of telling you “something” was null and pointing at a line?

A: We changed the default behavior to be “create a mock for everything.” We call it “Recursive Loose Mocking.” Unless you specify another mocking behavior, you cannot recieve nulls.

 

Q: What level of Visual Studio is being used?

A: Unless stated otherwise by a presenter, all presentations were in Visual Studio 2013 Ultimate

 

Q: What would the main difference/advantage be of using JustMock instead of Visual Studio’s Unit Test Project?

A: JustMock is a mocking framework you use in your unit tests. VS Unit Test Project provides you with the MS Test framework for writing the unit tests.

 Q: What is the difference between a Visual Studio unit test project (template) and a JustMock project?
A: The JustMock template has the Telerik.JustMock.dll already referenced. Other than that there is no difference.

Summary

We hope everybody enjoyed the webinar and found some new features in the Just products that they can’t wait to start using. If you have any further questions or comments please feel free to leave them in the comment section below. I would also like to encourage you to visit http://www.telerik.com/feedback.aspx to leave feedback about the Just products or any Telerik product.

JustCode download banner image

JustMock banner

 JustTrace banner

 JustDecompile banner


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.