Showing posts with label UnitTesting. Show all posts
Showing posts with label UnitTesting. Show all posts

Wednesday, January 08, 2014

Faking it gets a little better... the "Better Unit Testing with Microsoft Fakes" eBook that is...

Willy's Reflections - Better Unit Testing with Microsoft Fakes – eBook update v1.2 posted

Thanks to Michael Fourie, we have been able to action the backlog of community feedback for recent versions and package as part of the v1.2 eBook update.

Where can I get the new stuff?

...

Visual Studio Test Tooling Guides - v1.2 - Better Unit Testing with Microsoft Fakes

Release Notes

Welcome to the Better Unit Testing with Microsoft Fakes eBook
Quality-Bar Details

  • Documentation has been reviewed by Visual Studio ALM Rangers
  • Documentation has been through an independent technical review (UE)
  • All critical bugs have been resolved
Known Issues / Bugs
  • EPUB and MOBI downloads are still v1.0 and we have no plans to upgrade to v1.2.
Translations
  • Also available in Spanish!

image

Foreword
For modern development teams, the value of effective and efficient unit testing is something everyone can agree on. Fast, reliable, automated tests that enable developers to verify that their code does what they think it should, add significantly to overall code quality. Creating good, effective unit tests is harder than it seems though. A good unit test is like a good scientific experiment: it isolates as many variables as possible (these are called control variables) and then validates or rejects a specific hypothesis about what happens when the one variable (the independent variable) changes.

Creating code that allows for this kind of isolation puts strain on the design, idioms, and patterns used by developers. In some cases, the code is designed so that isolating one component from another is easy. However, in most other cases, achieving this isolation is very difficult. Often, it’s so difficult that, for many developers, it is unachievable.

First included in Visual Studio 2012, Microsoft Fakes helps you — our developers — cross this gap. It makes it easier and faster to create well-isolated unit tests when you do have systems that are “testable,” letting you focus on writing good tests and not on test plumbing. It also enables you to isolate and test code that is not traditionally easy to test, by using a technology called Shims. Shims use runtime interception to let you detour around challenging dependencies and replace them with something you can control. As we have mentioned, being able to create this control variable is imperative when creating high-quality, fast-running unit tests.

Shims provide a very powerful capability that will let you circumvent all kinds of roadblocks when unit testing your code. As with all powerful tools, there are a number of patterns, techniques and other “gotchas” that can take time to learn. This guidance document provides you with a jump-start on acquiring that knowledge by sharing a large number of examples and techniques for effectively using Microsoft Fakes in your projects.

We are happy to introduce this excellent guidance document produced by the Visual Studio ALM Rangers. We are sure that it will help you and your team realize the power and capabilities Microsoft Fakes provides you in creating better unit tests and better code.
...

A good book if you're looking for information about using the mocking/isolation framework from Microsoft, Microsoft Fakes.

 

Related Past Post XRef:
Faking it in VS11 - Moles, the Microsoft mocking/isolation framework, is baked into VS11

Interested in PEX & MOLES? Wish you could go to a five hour workshop on them? Here’s the next best thing…
Think you can’t unit test ASP.Net? Here’s a tutorial for one way, using the power of Pex and Moles

Tuesday, July 30, 2013

Free eBook of the Day: "Testing for Continuous Delivery with Visual Studio 2012" (now with ePub)

Microsoft Downloads - Testing for Continuous Delivery with Visual Studio 2012

Testing is potentially an obstacle to agile software deployment. The smallest change in your code could require the whole application to be retested. This book shows you how to minimize these costs by using the testing infrastructure of Visual Studio 2012. The code samples gives you a starting point to test your infrastructure.

Version: 1.0

Date Published: 7/30/2013

  • TestingForContinuousDeliverywithVisualStudi2012-EPUB.epub, 10.7 MB
  • TestingforContinuousDeliverywithVisualStudio2012.pdf,  12.9 MB
  • TIG.EXE, 1.7 MB

This book is aimed at test engineers, managers, developers, and folks interested in understanding the changing world of test. Over the last several years, software testing has changed a great deal. In the past, test plans were on paper, filed away and out of sight. Today they are—or can be with Visual Studio—living documents, as manual and automated tests are integrating into the test workflow supported by the test infrastructure.

Today you no longer have to set up physical boxes; instead you can set up and automate virtual environments composed of virtual machines to meet your testing environment needs. With Visual Studio and Team Foundation Server, the pain of dealing with a heterogeneous test infrastructure is reduced, the cost and effectiveness of testing a product is improved, and regression testing becomes cost effective instead of a nightmare.

Knowing how to test is important, but understanding how this new infrastructure is changing the business of testing and software delivery is critical. Today's businesses require nimble teams that can support continuous delivery and deal with updates and bugs in an agile fashion. It's what your customers have come to expect.

In this guide, we follow a team as they move from a conventional approach to testing towards one more suited to the needs of present-day development. We see how they address the costs and the pain of their old methods by adopting the testing infrastructure of Visual Studio 2012

Looks like a re-release of "Testing for Continuous Delivery with Visual Studio 2012" eBook (Think Story based approach to presenting "Testing for Continuous Delivery"), but now with an ePub version. The date info in the PDF is still 12/2012...

But still, a nice reminder about this resource won't hurt. :)

 

Related Past Post XRef:
"Testing for Continuous Delivery with Visual Studio 2012" eBook (Think Story based approach to presenting "Testing for Continuous Delivery") 
"Testing for Continuous Delivery with Visual Studio 2012 RC" Free eBook (PDF) and code samples from Microsoft Patterns & Practices

Tuesday, April 23, 2013

You are such a Code Digger... Code Digger VS2012 extension released (Think "Pex powered input/output analysis for Portable Libraries Extension")

Nikolai Tillmann's Blog - Introducing: Code Digger, an extension for VS2012

Today, the Pex team at Microsoft Research (Nikolai Tillmann and Peli de Halleux) is happy to announce that Code Digger, an extension for Visual Studio 2012, has shipped to the Visual Studio Gallery. After shipping the Moles framework as Fakes in Visual Studio 2012, this is the next step of bringing our research projects to the latest and greatest development environment.

Download now from Visual Studio Gallery

Code Digger comes as a lightweight Visual Studio extension.

http://visualstudiogallery.msdn.microsoft.com/fb5badda-4ea3-4314-a723-a1975cbdabb4

...

What is Code Digger?

Code Digger generates interesting values that show different behaviors of your .NET code. The result is a table showing for which inputs your code produces which outputs.

What is the relation between Pex and Code Digger?

Under the hood, Code Digger uses the Pex engine and Microsoft Research’s Z3 constraint solver to systematically analyze all branches in the code, trying to generate a test suite that achieves high code coverage. Working together with Peter Provost from the Visual Studio product group, we tried to create a really simple user interface. We want to bring the idea of code exploration to every programmer’s fingertips. This is different from the Pex Power Tools where we gave you many options to configure, and you had to embrace the idea of (Parameterized) Unit Testing to get all benefits. Code Digger is not a full replacement of Pex, it is merely the first extension that the Pex team ships for Visual Studio 2012 – stay tuned for more.

Limitations

Code Digger only works on public .NET code that resides in Portable Class Libraries.

By restricting the code exploration to Portable Class Libraries, we avoid problems with code that has dependencies on a particular platform which the Pex engine does not understand.

image

Visual Studio Gallery - Microsoft Code Digger

Overview

Code Digger analyzes possible execution paths through your .NET code. The result is a table where each row shows a unique behavior of your code. The table helps you understand the behavior of the code, and it may also uncover hidden bugs.

Through the new context menu item "Generate Inputs / Outputs Table" in the Visual Studio editor, you can invoke Code Digger to analyze your code. Code Digger computes and displays input-output pairs. Code Digger systematically hunts for bugs, exceptions, and assertion failures.

Code Digger only works on public .NET code that resides in Portable Class Libraries.

Under the hood, Code Digger uses the Pex engine and Microsoft Research’s Z3 constraint solver to systematically analyze all branches in the code, trying to generate a test suite that achieves high code coverage.

Code Digger is the first extension from the Pex team at Microsoft Research for Visual Studio 2012. Stay tuned for future extensions that bring more aspects of the rich experience of the Pex Visual Studio 2010 Power Tools to the latest version of Visual Studio. If you have feedback for us, or bug reports, feel free to write an email to the Pex team at Microsoft Research. If you have used Pex before, let us know if you are missing a particular feature.

To stay up-to-date, like Pex and Moles on Facebook.

..."

That's an interesting VS Extension and I like how it leverages Pex and MSR work. The fact it only works on Portable Libraries limits it for me, but still I think this is kind of cool...

 

Related Past Post XRef:
[Rumor] Pex and Moles to be part of Visual Studio 11?

Interested in PEX & MOLES? Wish you could go to a five hour workshop on them? Here’s the next best thing…

Think you can’t unit test ASP.Net? Here’s a tutorial for one way, using the power of Pex and Moles
Playing with Pex is just a web browser away at www.pexforfun.com

Pex 2010 (aka Pex 0.90.50303.0) now available on MSDN Subscribers Downloads
Pex license updated – You can now use it in commercial projects
Pex 0.5 Released - Your Parameterized Unit Test Buddy

Thursday, February 07, 2013

Unit Test Stored Procedures? Here's one example...

Gunnar Peipman's ASP.NET blog - Using database unit tests in Visual Studio

Stored procedures in SQL Server database can be unit tested using Visual Studio database unit tests. It may seem as simple thing to do at first but when you start writing tests then you will find out it’s more complex task to do then expected. In this posting I will introduce database testing with Visual Studio tools.

NB! In this posting I will use Visual Studio 2010 as I was not able to make database unit tests run on Visual Studio 2012. VS2012 has also these tests available but it seems to me that this support is still raw and waits for stabilization and fixes.

Are they actually unit tests?

I am not very sure that these tests can be called unit tests. They are different than unit tests we are used from applications development. As these tests may also test integrated components in database I would rather call these tests as database tests. Considering these tests to be wider than unit tests is okay because same mechanism allows us write very different tests for databases.

Why database testing?

Databases are often more complex beasts than just some tables, keys and indexes. Often databases contain complex queries, stored procedures and user-defined functions. SQL Server has also support for CLR libraries. All these database objects contain some logic that is usually very important.

Systems that make heavy use of stored procedures are good targets for database tests. Actually there are two ways how to test these databases:

  • regular integration tests against some service or set of classes that make data available to system,
  • database tests.

Database tests seems better option to me because then we don’t include code from other layers to tests and therefore bugs in other layers cannot affect the results of database tests.

..."

Every six months I get this "want" to unit test my SQL and go about re-discovering what the current state of it is. This post reminded me that it's getting to be close to that six month period...

Wednesday, January 30, 2013

VS2012.2 CTP Released ("Blue is back, baby...")

Brian Harry's blog - Announcing Visual Studio 2012 Update 2 (VS2012.2)

Today we released the first Community Technology Preview (CTP) of Visual Studio 2012 Update 2 (VS2012.2).  It’s exciting to see the next update of VS working it’s way to completion.  There’s going to be a ton of cool new capabilities in Update 2.  Not all of them are available in this CTP but many are.  Below, I’ve described the significant improvement’s that you’ll find in this CTP and I’ve grouped them into 4 categories:

  1. Agile Planning
  2. Quality Enablement
  3. Line of Business Development
  4. Developer Experience

This CTP is NOT a “go-live” CTP.  It is for evaluation only.  We’re trying to learn from Update 1 and get feedback earlier in the cycle.  We will be having “go-live” pre-releases of Update 2 in order to facilitate that but not quite yet.

You can download the CTP here: http://go.microsoft.com/fwlink/?LinkId=273878

..."

There's a good deal of goodness in this release, from features moving down the SKU stack...

Fakes & stubs in Premium – We have decided to include Fakes & Stubs in VS Premium (in addition to Ultimate) to allow unit tests to be more easily shared across the whole team.

Unit Testing love;

Some test process customization – Customize the list of possible test resolution and failure types.

Group unit tests by class – Another way to easily categorize/organize tests.

Playlists – Easily create arbitrary groups of unit tests, save them and run them.

Including Blend for VS;

Blend for VS 2012 – We’ve added back Blend for VS 2012, including support for WPF, Silverlight and Sketchflow.

To baking in the blue theme;

Visual Studio Blue Theme – We’ve incorporated the popular the VS “Blue” theme that we released on VSGallery into Update 2.

image

Lots for everyone in this release. But please note this is NOT a Go-Live release!

Tuesday, January 22, 2013

Ben's Unit Testing &TDD Courseware for Visual Studio 2010 (for free)

Benjamin Day Consulting, Inc. - Unit Testing & Test-Driven Development Courseware for Visual Studio 2010

Well, like I mentioned in my last post, I’m planning to publish a lot of the old courseware that I’ve developed over time.  The idea is to share the materials that I’m no longer using with the good folks on the internet rather than to have it all sitting around collecting virtual dust on my laptop.

This time, I’m pushing out the labs and slides for my 2-day unit testing & test-driven development (TDD) course for Visual Studio 2010.  A few months ago, I started looking at upgrading the VS2010 course to Visual Studio 2012 and decided that it was actually time for a re-write because I don’t really write tests the same way anymore.   

The labs for this course focus on process and software architecture patterns for how to:

  • Create unit tests for a Deck of Cards using TDD
  • Unit test the Adapter pattern
  • Unit test the Repository pattern
  • Using mock objects to test in isolation
  • Unit testing a user interface using the Model-View-Presenter (MVP) pattern

Here are the materials for the course:

  • Course description and syllabus
  • Slides in PDF format
  • Slides in PowerPoint format
  • Labs in PDF format
  • Code for the labs (before and after) [GD:Click through for the download links]

Course description and syllabus

Unit Testing & Test-Driven Development with Visual Studio 2010

Unit testing enables you and your team to write high-quality software with fewer bugs. It also allows you say with confidence when something in your code is working and – more importantly – know when it is not working. Test-Driven Development (TDD) is a methodology for writing software that ensures that your application and your application code are testable and tested from the very start. This course is designed to give the student hands-on experience and knowledge for writing and maintaining applications using Test-Driven Development. Throughout the course we will discuss the options, process, and motivations for unit testing and TDD and reemphasize these concepts using hands on labs.

What you’ll learn:
· What is a unit test?
· What is Test-Driven Development (TDD)? Why is TDD important?
· What is the TDD process?
· Common (bogus) excuses for NOT doing Unit Testing & TDD
· How do I sell my team on Unit Testing & TDD?
· Create and write unit tests
· Test types in Visual Studio 2010
· Architect your application for testability
· Testing user interfaces
· Test non-public methods
· Strategies for unit testing legacy code
· The RhinoMock Framework – Mocks & Stubs
· Using Mocks & Stubs to avoid The Huge Integration Test pitfall
· Dealing with databases and test data in your unit tests
· Mocking web services, back-end systems, and database calls
· Design Patterns for testability: Repository, Adapter, N-Tier Architecture, Model-View-Presenter (MVP), Model-View-Controller (MVC), and Model-View-ViewModel (MVVM)
· Best Practices for fixing bugs & defects using TDD
· Refactor for testability
· What is Code Coverage and why do I care?
· What other non-TDD test types are available? Web Testing, Load Testing, and Coded UI Tests

This looks like a great learning resource, and since there's still a great many people on VS2010 (Yes, I'm looking at you...) I thought you all might find this useful. And even if you've moved forward, there's a good deal you can learn... :) Sure, it's only the "resources" and not the actual training, but that's still pretty cool. :)

Friday, December 14, 2012

SQL Server Data Tools gets Database Unit Testing... (and Power Tools are now baked in and more)

SQL Server Data Tools Team Blog - Available Today: SSDT—December 2012

The SSDT team is pleased to announce that SQL Server Data Tools - December 2012 is now available for download!

What’s New?

Database Unit Testing

We have received an overwhelming amount of feedback that database unit testing is a critical feature for customers, so SSDT- December 2012 adds support for this feature. Database Unit Testing in SSDT will look familiar to many of you as it is based on the equivalent capability in the Visual Studio 2010 DB Pro tools.  Some highlights:

  • Installs in Visual Studio 2010 or Visual Studio 2012:
    • Requires Visual Studio Professional or higher edition to support database unit testing functionality.
    • Installs side-by-side with existing Visual Studio 2010 DB Pro tools in Visual Studio Premium and Ultimate editions.
  • Supports client-side testing based on MSTest with the same built-in test conditions as DB Pro.
  • Allows desktop development and execution of tests as well as execution from the command line or as part of a build on a build server.
  • Upgrades existing VS 2010 test projects without change to the database unit test scripts or code.
  • Integrates with SSDT SQL Server database projects:
    • Automates deployment of the database project on test initialization.
    • Generates skeleton test scripts for stored procedures, functions and triggers via SQL Server Object Explorer.
    • Applies changes to test scripts when refactoring objects in database projects.   
  • Supports custom test conditions (existing custom test conditions need to be modified before they can be used).

image

Integration of SSDT Power Tools

The SSDT team started releasing SSDT Power Tools last April as a mechanism to deliver new and experimental features with each release. Since then, the Power Tools have been downloaded over 24,500 times.

We received a great deal of positive feedback on the Power Tools and as a response, this release integrates the functionality previously delivered via Power Tools into the core SSDT product. The advantage of product inclusion is that a separate install will no longer be needed and that features are now fully supported and available to users in all languages. The following features are now included in SSDT's SQL Server Object Explorer:

...

Updated Data-Tier Application Framework

...

Bug fixes

SSDT - December 2012 contains over 50 bug fixes, including fixes for customer-reported issues from SSDT - November 2012 and SSDT Power Tools releases.

Good to see Database Unit testing is back...

(via SSIS Junkie - Database unit testing is now available for SSDT)

 

Related Past Post XRef:
SSDT (SQL Server Data Tools) September 2012 for VS2010/2012 now available
SQL Server 2012 RTM Day Download Link Round-up

Tuesday, December 04, 2012

"Testing for Continuous Delivery with Visual Studio 2012" eBook (Think Story based approach to presenting "Testing for Continuous Delivery")

Microsoft Downloads - Testing for Continuous Delivery with Visual Studio 2012

Testing is potentially an obstacle to agile software deployment. The smallest change in your code could require the whole application to be retested. This book shows you how to minimize these costs by using the testing infrastructure of Visual Studio 2012. The code samples gives you a starting point to test your infrastructure.

Version:1.0
Date published:10/26/2012

Language:English

TestingforContinuousDeliverywithVisualStudio2012.pdf, 14.2 MB
TIG.EXE, 1.7 MB

This book is aimed at test engineers, managers, developers, and folks interested in understanding the changing world of test. Over the last several years, software testing has changed a great deal. In the past, test plans were on paper, filed away and out of sight. Today they are—or can be with Visual Studio—living documents, as manual and automated tests are integrating into the test workflow supported by the test infrastructure.

Today you no longer have to set up physical boxes; instead you can set up and automate virtual environments composed of virtual machines to meet your testing environment needs. With Visual Studio and Team Foundation Server, the pain of dealing with a heterogeneous test infrastructure is reduced, the cost and effectiveness of testing a product is improved, and regression testing becomes cost effective instead of a nightmare.

Knowing how to test is important, but understanding how this new infrastructure is changing the business of testing and software delivery is critical. Today's businesses require nimble teams that can support continuous delivery and deal with updates and bugs in an agile fashion. It's what your customers have come to expect.

In this guide, we follow a team as they move from a conventional approach to testing towards one more suited to the needs of present-day development. We see how they address the costs and the pain of their old methods by adopting the testing infrastructure of Visual Studio 2012.

image

From the Forward:

This book tells the story of two companies, Contoso and Fabrikam. Over my thirty years in the software industry, I’ve seen lots of companies that work like Contoso. Fortunately, over the last decade, I’ve also seen more and more like Fabrikam.

There never has been a better time for software. We can now produce a better flow of value for our customers, with less waste and more transparency than we ever could before. This revolution has been driven largely from the bottom, by small, agile, fast-moving development teams at places like Fabrikam. It’s a global revolution, visible in places as unlike one another as Silicon Valley, Estonia, China, Brazil, and India.

Those of us in mature economies need to keep pace. Our supply chains are morphing into supply ecosystems. Software is no longer about designing everything to build; it’s about finding parts to reuse and rapidly experimenting with innovation—the one thing you can’t reuse or outsource. Every time you pick up your smartphone, you experience the benefits of this cycle.

Software testing needs to keep pace too. In the days of Contoso, we thought about minimizing “scrap and rework.” Now at Fabrikam, we think of rapid experimentation and a continuous cycle of buildmeasurelearn. Testers are no longer the guys who catch stuff over the wall, but are full members of a multidisciplinary, self-organizing team. While their role at Contoso was defensive—do no harm to the customer, at Fabrikam it is offensive—anticipate the customer’s behavior and wishes and be the first and best advocates.

Welcome to testing at Fabrikam. It’s a lot more hectic around here, but it’s also a lot more fun and rewarding

(via News from the South Africa Developer and Platform Group - Visual Studio Update 1 Videos and Testing for Continuous Delivery Book)

 

Related Past Post XRef:
"Testing for Continuous Delivery with Visual Studio 2012 RC" Free eBook (PDF) and code samples from Microsoft Patterns & Practices

Tuesday, October 30, 2012

gtest C++ unit testing test adapter for Visual Studio 2012 now available (beta)

Visual Studio Gallery - Google Test Adapter

Unit Test Adapter for Google Test (gtest).

This is a beta release of an unit test adapter for Visual Studio 2012 supporting gtest tests.

To browse, run and evaluate your gtest tests just build your solution and open the Test Explorer via the TEST menu. You can find more information regarding gtest here.

...

image

..."

googletest

Google's framework for writing C++ tests on a variety of platforms (Linux, Mac OS X, Windows, Cygwin, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, value- and type-parameterized tests, various options for running the tests, and XML test report generation.

...

Google Test-related open source projects

Google Test UI is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#.  ..."

Now this is something I doubt I'll hear much about here at //build/ so I guess it makes it a perfect blog post for today, doesn't it?

Why? Because this shows just awesome Visual Studio 2012's new Unit Testing is. Oh sure, there's some things I really really hate in the RTM version (which I hope will be fixed in Update 1 [Note to Self: talk to the VS team here at //build/ about this]) but still I think it's pretty cool that even a unit testing tool from Google can be integrated into Visual Studio...

Monday, October 15, 2012

Free your Typemock... New Typemock Isolator Basic is now available and free (Updated Typemock Isolator Essential & Typemock Isolator Complete also available)

ASP.NET Forums - Announcements - Typemock releases a new version of Isolator, suitable for all levels of software developers – including a FREE version

"Unit testing is a key element for any software developer, development team, or business. With proper unit testing, companies can reduce the cost of software defects while maintaining code quality and allowing for faster time-to-market. Typemock is committed to making unit testing easier and more accessible to developers and organizations.

The new Typemock Isolator packages provide easy unit testing tools to all developers as well as organizations based on their specific needs.

All versions support ASP.NET and ASP.NET MVC as well as the rest of .NET Framework

Typemock Isolator Basic - The basic package is a FREE unit testing framework, for developers without legacy code to test, which provides basic mocking functionality along with the smartrunner and coverage indicator features only. With Isolator Basic anyone with green field projects can unit test and engage in Test Driven Development with the proven power and benefit Typemock offers.

Download it now: http://www.typemock.com/isolator-product-page

Typemock Isolator Essential - ...

Typemock Isolator Complete - ..."

Typemock - Typemock Isolator - Easy Unit Testing in .NET

Isolator is a complete unit testing and Test Driven Development (TDD) solution, which helps you work smarter and prevent costly bugs in your code.

image..."

Free is something that's easy for me to sell. Sure the free version is limited, but it looks like there's enough there to get a feel for the product before you spend the big bucks on it...

 

(via dotNetSlackers - Typemock releases a new version of Isolator, suitable for all levels of software developers including a FREE version.)

Monday, June 25, 2012

Let the moose run free...! Mighty Moose, a Continuous Testing Tool, is now free (as in free)

CodeBetter.com - Mighty Moose Free

"As some of you may know Svein (@ackenpacken) and I have decided to make Mighty Moose free. This is not a decision that is being take lightly and much thought has gone into it. This post is to explain why we went free and the future

...

Mighty Moose is from this point forward free. Not “free in beta” or “free with a bunch of functionality turned off” but free (license is being updated as I write this). We announced this rather quietly at NDC.

Many people have asked me “why would you go free? you could charge for what you have.”. This is true. Continuous Testing tools will be taking off and yes we could charge for it however its not quite as simple as that.

...

image..."

ContinuousTests.com

Nope, this ain't the moose that bit Svenge's sister in law while she was carving her initials in the tree with the sharpened end of an interspace toothbrush.

This is the Mighty-Moose that will keep a steady eye on all your tests. If any piece of code changes, he'll look up any affected tests and demand verification. Think of him as your personal Super Tester, your testing go-to guy, the mammal that can read The Matrix, for he is The Moose!

ContinuousTests is a continuous testing tool for the .Net and Mono platform. It helps you with the way you do TDD by taking care of all compiling and testing in the background to help you work more efficiently. It also figures out exactly which tests to run, based on the changes you just made. So, instead of running all tests, it will only run those affected by your changes.

In addition to making sure your work flow is optimized, its features include graphs visualizing the relation between a piece of code and the tests run on it, annotation inside your code showing risk you are taking changing this piece of code, and more.

image

Need to see more?, http://www.continuoustests.com/see.html

SNAGHTML42dac531

Not a tool that had been on my radar, but now it sure is. I really appreciate the time Greg put into his post about their thinking about releasing this as a free product or not...

Saturday, June 09, 2012

The big BK has updated the Visual Studio 2012 RC ALM Virtual Machine and Hands-on-Labs

Brian Keller - Updated: Visual Studio 2012 RC ALM Virtual Machine and Hands-on-Labs / Demo Scripts

"The Visual Studio 2012 RC ALM Virtual Machine is now available!

This new VM replaces the previously available Visual Studio 11 Beta ALM virtual machine to use the latest Visual Studio 2012 RC releases.

This is hands-down the most comprehensive ALM virtual machine yet. It includes 18 hands-on-labs / demo scripts. 6 of these were upgraded from the Visual Studio 11 ALM virtual machine, 11 of these were upgraded from the older Visual Studio 2010 ALM virtual machine, and one is brand new, highlighting the PreEmptive Analytics integration in Team Foundation Server 2012. Phew!"

Brian Keller - Visual Studio 11 Application Lifecycle Management Virtual Machine and Hands-on-Labs / Demo Scripts

June 6, 2012 Update: This post and the accompanying downloads have been updated based on the Visual Studio 2012 RC which was released last week.

I’m very pleased to announce the availability of the Visual Studio 2012 RC ALM Virtual Machine along with 18 hands-on-labs / demo scripts. This includes 7 ALM scenarios which are new in Visual Studio 2012, and another 11 scenarios which were introduced in Visual Studio 2010, giving you a single virtual environment for learning about or demonstrating a wide range of ALM capabilities.

You can download and install the RC of Visual Studio 2012 (and Team Foundation Server 2012, .NET Framework 4.5, etc.) and even use it in production with our “go live” license. But if you would like a fast way to understand what is new for application lifecycle management in this release, this virtual machine is pre-configured with all of the necessary software and sample data for you.

Before I get into what’s included, there are a few quick limitations to disclose:

  • This is a Hyper-V virtual machine and works with Windows Server 2008 x64 (Windows Server 2008 R2 SP1 is recommended). If you try to load this with Virtual PC it will blue screen since Virtual PC does not support 64-bit operating systems. This virtual machine has also been tested to work with the Windows 8 Release Preview and the Windows Server 2012 Release Candidate, but the instructions provided assume you are using Windows Server 2008 R2 SP1. Some modification may be needed to use other platforms.
  • Windows is configured to set the system clock to May 16, 2012 every time you start this virtual machine. This is to support the project management hands-on-lab. If you want to work with this virtual machine beyond the specific hands-on-labs scenarios, you may need to disable the Set Date and Time task (Task Scheduler -> Task Scheduler Library -> Set Date and Time -> Right-Click -> Disable).
  • Please take a few minutes to read the attached “Working with…” document for some important instructions on properly importing and working with this virtual machine.

With the limitations out of the way, onto the fun stuff…

...

There are 18 hands-on-labs for you to take a scripted approach towards learning this content. These labs double as demo scripts in case you want to show off these features to others:

New features in Visual Studio 2012:

Labs upgraded from Visual Studio 2010:

..."

And of course he's provided download manager friendly list of download url's to make getting this VHD easy...

Now what would be cool would be having this VM available on the new Windows Azure VM service (actually for me to be able to create a diff off of it)

 

Related Past Post XRef:
VS 11 ALM DemoMates updated for the Beta

Visual Studio/TFS11 ALM Demo's... Mate! See the VS/TFS 11 ALM's hands-on-labs in DemoMate form

Visual Studio 11 ALM VHD's, VirtualBoxed (and even on x86 hosts too)
Want to play with Visual Studio 11 & TFS 11 Dev Preview but don't want to install it (and have access to a Hyper-V server)? Here's a VHD just for

Friday, May 18, 2012

"Why I Hate Unit Testing"

The Telerik Blogs - Why I Hate Unit Testing

"So you went to work for the cool company that wooed you with promises of cutting edge technologies and techniques. In the interview, they told you that they are agile and unit test everything. You may or may not have been in an agile environment before, but the important thing you are enthusiastic about joining a team that truly gets software development. You tested on your previous job, even using JustMock to write better tests. You promise you can be agile yourself and quickly adopt their practices. You’re immediately hired.

Many of you have been there… maybe you’re there right now.

It takes a few days to receive your workstation, and you find most of the development software isn’t set up. A coworker gives you the instructions, and by the end of the day you find yourself still struggling to connect to the version control server.

The next day, you ask your manager about your problem. It turns out that the person in charge of the version control and build servers left a few months back; you’re the replacement. Further inquiries lead to a startling truth: no one has administrative access.

...

Don’t Hate the Game, Hate the Player

If you have entered a company with poor unit testing practices, you will likely encounter other problems. Many practices and methodologies follow each other, and improper implementation for one item may encourage improper implementation in another. Many companies are successful with different practices in place, and none of this is one-size-fits-all. Steve Forte and Joel Semeniuk have a great presentation on this called The Agile Buffet Table. The most important thing is to regularly analyze your practices and determine if revision is necessary or if everything is okay. And please, realize it’s bad if no one has administrative access to your source control system!

Unit testing is great when done right, and it’s even good when done in a lax manner. However, it’s better to have no unit tests than terrible unit tests.

I hate unit testing done poorly.

image..."

The sad thing is that this could have been a true story (and probably was as it just rings too true doesn't it?). That said, I liked how it provided some great, fairly vendor independent, guidance if you're in this kind of boat.

Tuesday, April 03, 2012

Windows Phone Developer Guidance Updated. Building WinPhone7.1/5 apps with MVVM, that are testable and more...

Francis K. Cheung - SHIPPED!!! Windows Phone Developer Guidance updated for Mango (WP SDK 7.1)

We dramatically updated our guidance around Windows Phone development. Beyond recompiling our previous guidance against the Mango SDK, the latest guidance takes advantage of many Mango features such as fast app switching, background tasks, and new sensor APIs. We also did a fair amount of work showing how to create a layer of abstraction on top of the Windows Phone APIs that facilitates unit testing.

We split up our guidance into three parts:

  1. Developing a Windows Phone Application using the MVVM Pattern
    This guidance walks you through building a simple Windows Phone application using CodeBehind files. The guidance then shows you how the same app can be much more unit testable when built using the MVVM pattern.
  2. A Case Study for Building Advanced Windows Phone Applications
    This guidance takes an in-depth look at how to write an advanced Windows Phone application, using many features of Mango. Unit testability was an important factor that guided the design of this application.
  3. Building Testable Windows Phone Applications
    Taking the work on unit testability from the above guidance, this guidance provides shorter samples of how to build unit testable Windows Phone applications.

..." [GD: Post Leach Level 99%]

Developing a Windows Phone Application using the MVVM Pattern

This documentation and accompanying sample application will get you started building easily testable applications that target Windows® Phone OS 7.1. You will learn the basics of the Model View View-Model (MVVM) pattern and dependency injection through a sample application that enables you to track the petrol consumption of three vehicles. The sample application is authored two different ways so that you can see the progression from a code-behind implementation to a view model implementation whose dependencies are injected.

Some of the topics that you will learn about include the following:

image

A Case Study for Building Advanced Windows Phone Applications

Windows® Phone provides an exciting opportunity for companies and developers to build applications that travel with users, are interactive and attractive, and are available whenever and wherever users want to work with them. The latest release of Windows Phone furthers this opportunity by enabling you to build many classes of applications that were not previously possible.

By combining Windows Phone applications with on-premises services and applications, or remote services and applications that run in the cloud (such as those using the Windows Azure™ technology platform), developers can create highly scalable, reliable, and powerful applications that extend the functionality beyond the traditional desktop or laptop, and into a truly portable and much more accessible environment.

This guide describes a scenario concerning a fictitious company named Tailspin that has decided to embrace Windows Phone as a client device for their existing cloud-based application. Their Windows Azure-based application named Surveys is described in detail in a previous book in this series, Developing Applications for the Cloud on the Microsoft Windows Azure Platform 2nd Edition. For more information about that book, see the page by the same name on MSDN® at (http://msdn.microsoft.com/en-us/library/ff966499.aspx).

In addition to describing the client application, its integration with the remote services, and the decisions made during its design and implementation, this book discusses related factors, such as the design patterns used, and the ways that the application could be extended or modified for other scenarios.

Some of the topics that you will learn about in this guide include the following:

  • Using the MVVM pattern
  • Displaying user interface notifications
  • Managing state and performing navigation
  • Encrypting and decrypting credentials
  • Persisting data to and from isolated storage
  • Synchronizing data between a Windows Phone device and a cloud service, both in the background and the foreground
  • Pinning Application Tiles and secondary Tiles to Start
  • Capturing location data, image data, and audio data
  • Authenticating with a cloud service from a Windows Phone application
  • Pushing notifications to Windows Phone devices
  • Transferring data between a Windows Phone device and a cloud service
  • Abstracting the Windows Phone 7.1 SDK
  • Unit testing MVVM applications

The result is that, after reading this book, you will be familiar with how to design and implement advanced applications for Windows Phone that take advantage of remote services to obtain and upload data while providing a great user experience on the device.

...

image

..."

Building Testable Windows Phone Applications

"This documentation and accompanying sample applications will show you how to build easily testable applications that target Windows Phone OS 7.1.

Some of the topics that you will learn about include building testable Windows Phone applications that:

Audience

This documentation and accompanying sample applications are best suited for developers with the following experience levels.

Some experience with:

  • C#
  • Silverlight
  • Windows Phone 7.0 or 7.1 SDK
  • The Model-View-ViewModel (MVVM) pattern

Little or no experience with:

  • Building testable Windows Phone applications

...

image

..."

Some light reading for the week...

Tuesday, January 17, 2012

Making testing in Visual Studio demon hot... New RedGate ".NET Demon" Visual Studio Extension beta

Alex Davies - A new toy - .NET Demon

"I'd like to present a new tool for .NET Developers that we've been cooking up in the Red Gate .NET team. It's only a beta at the moment, but it works for most people.

.NET Demon Beta

It's a Visual Studio extension that cuts the time you spend waiting to find whether your code is right. It does this by:

  • Continuous testing (running your NUnit tests as you type)
  • Continuous compilation (so you can start running instantly because your code is already compiled)
  • Inline code coverage (so you know which tests are covering the code you're editing, and if they start failing)
  • Continuous save (so you don't have to press ctrl-S ever again)

..."

RedGate - .NET Demon

"Take the waiting out of Visual Studio development

.NET Demon automatically compiles and tests your code in the background.

Continuous testing

Be a better coder by getting faster feedback from your unit tests.

  • Takes care of running your tests while you code
  • Shows code coverage and test results alongside the your code
  • Intelligently only runs tests impacted by your changes
Start running instantly

Even if you don't have unit tests, .NET Demon will help you to test your code faster.

  • Continuous compilation means your code is already compiled when you need it
  • Intelligently only compiles projects impacted by your changes
  • Cleanly replaces the normal Visual Studio build system
Continuous save

.NET Demon saves your work as you type, so you can give your ctrl and S keys a rest.

Learn more

Find out more about .NET Demon

image..."

You had me at "Continuous Save..." :)

Sunday, December 18, 2011

[Rumor] Pex and Moles to be part of Visual Studio 11?

The Curly Brace - Pex and Moles to be Visual Studio 11 Feature Set

"In true, "I will neither confirm nor deny" Microsoft fashion, a little bird in Redmond informed me that Pex and Moles will have no further releases, because they are being "productized". Another, larger bird stated, "dependency isolation will be taken care of, in Visual Studio 11," when I asked if Moles and Pex will be rolled into VS11.

The Visual Studio 11 community technical preview (CTP) is available for download to anybody. However, the Moles and Pex products are not yet integrated into the application. There are several points of integration the need to be perfected, before adding it.

..."

Hope this is true... I'd dig to see these projects baked into a release of VS.

BTW, if you're looking for more Pex/Moles info, make sure you check out, Testing with Microsoft Pex & Moles, also by Mike Christian

 

Related Past Post XRef:
Interested in PEX & MOLES? Wish you could go to a five hour workshop on them? Here’s the next best thing…

Think you can’t unit test ASP.Net? Here’s a tutorial for one way, using the power of Pex and Moles

RiSE4Fun - Microsoft Research, Research in Software Engineering, "Fun" Dev, via web, site
Playing with Pex is just a web browser away at www.pexforfun.com

Pex 2010 (aka Pex 0.90.50303.0) now available on MSDN Subscribers Downloads
Pex license updated – You can now use it in commercial projects
Pex 0.5 Released - Your Parameterized Unit Test Buddy

Wednesday, November 30, 2011

Red Gate adds TSQL unit testing to SSMS

Scarlet & Scary - Unit Testing TSQL

"I went through a period of time where I spent a lot of effort figuring out how to set up unit tests for TSQL. It wasn't easy. There are a few tools out there that help, but mostly it involves lots of programming. well, not as much as before. Thanks to the latest Down Tools Week at Red Gate a new utility has been built and released into the wild, SQL Test.
Like a lot of the new tools coming out of Red Gate these days, this one is directly integrated into SSMS, which means you're working where you're comfortable and where you already have lots of tools at your disposal. After the install, when you launch SSMS and get connected, you're prompted to install the tSQLt example database.  
...
The concepts are pretty straight forward. There are a series of CLR commands that you use to configure a test and the test assertions. In between you're calling TSQL, either calls to your structure, queries, or stored procedures. They already have the one things that I always found wanting in database tests, a way to compare tables of results. I also like the ability to create a dummy copy of tables for the tests. It lets you control structures and behaviors so that the tests are more focused. One of the issues I always ran into with the other testing tools is that setting up the tests might require potentially destructive changes to the structure of the database (dropping FKs, etc.) which added lots of time and effort to setting up the tests, making testing more difficult, and therefor, less useful.

Functionally, this is pretty similar to the Visual Studio tests and TSQLUnit tests that I used to use. The primary improvement over the Visual Studio tests is that I'm working in SSMS instead of Visual Studio. The primary improvement over TSQLUnit is the SQL Test interface it self. A lot of the functionality is the same, but having a sweet little tool to manage & run the tests from makes a huge difference. Oh, and don't worry. You can still run these tests directly from TSQL too, so automation has not gone away.
..."
Red Gate - SQL Test
image
SQL Test is a unit test plug-in for SQL Server Management Studio. 
What can SQL Test do for you?
  • Start writing and running unit tests immediately, without a complex, time consuming set-up process.
  • Effortlessly view all of your unit tests and results in a convenient dockable panel.
  • Easily share unit tests with team members for faster bug fixes and enhancements.
Why use unit testing?
  • Discover bugs much earlier in the development cycle.
  • With unit testing, continuous integration, Agile Development, and test driven development are finally achievable goals.
...
image..."
What is that tSQLt thing?
tSQLt.org
"Welcome to tSQLt – The Database Unit Testing Framework for SQL Server

What is tSQLt?
tSQLt is a database unit testing framework for Microsoft SQL Server. tSQLt is compatible with SQL Server 2005 (service pack 2 required) and above on all editions.

Main Features
tSQLt allows you to implement unit tests in T-SQL. This is important as you do not have to switch between various tools to create your code and your unit tests. tSQLt also provides the following features to make it easier to create and manage unit tests:
  • Tests are automatically run within transactions – this keeps tests independent and reduces any cleanup work you need
  • Tests can be grouped together within a schema – allowing you to organize your tests and use common setup methods
  • Output can be generated in plain text or XML – making it easier to integrate with a continuous integration tool
  • Provides the ability to fake tables and views, and to create stored procedure spies – allowing you to isolate the code which you are testing
..."
Interesting. If a third party is going to do something right in this space Red Gate is the company that would do it...

Note: When I wrote this post, this was a free beta. Now that it's been released it's no longer free (there's currently a 28 day trial though)

Friday, June 24, 2011

A quick guide to SpecFlow, WatiN in a ASP.Net MVC world by Steven Smith

Steven Smith - Everything You Need to Get Started with SpecFlow and WatiN

I’m adding SpecFlow to an application I’m working on so that I can add some acceptance tests that actually exercise the user interface. I’ve only spent a couple of hours on it thus far, but I have it working with a single specification running through the tests via WatiN. I found the following resources helpful as I was going through this exercise:

  • ...

I’m assuming that you’re just interested in getting up to speed with SpecFlow for acceptance testing and that you don’t want to waste any time on hidden gotchas or visiting all of the above URLs just to figure out what you actually need. Let me just give you the Stuff You Need To Know™.

Installing SpecFlow

...

SNAGHTML1d3e3626

Testing ASP.NET MVC with WATIN

...

Automation and Reporting

...

Summary

There’s not a whole lot to getting SpecFlow and WatiN working with your ASP.NET (MVC) application. There are a few hidden gotchas that I’ve tried to cover in this post. Hopefully this will provide all of the resources you need. If there’s something missing, please let me know and I will provide an update to address the issue. The nice thing about the final HTML report you get is that you can sit down with the customer or project stakeholder and create all of the major features and many of the known scenarios prior to an iteration or release cycle, and then provide regular updates showing progress being made on a feature-by-feature (and scenario-by-scenario) level. Assuming the documented executable specifications accurately reflect the customer’s needs, these acceptance tests provide a common definition of what “done” is for the project, reducing the frequency of the team delivering incomplete or incorrect features."

I've heard a bit about SpecFlow and like the idea behind it. I don't think I've seen a good soup-to-nuts getting started guide like this before...

Sunday, December 19, 2010

Retargeting VS2010 Unit Tests to .Net 3.5 (with VS2010 SP1)

Visual Studio Team Test - How to re-target unit-tests to .Net Framework 3.5 in VS 2010 SP1

Visual Studio 2010 Service Pack 1 enables basic support for unit tests that target .Net framework 3.5.  With this support the users can:

  • Create new unit-test projects and target them to the .NET Framework 3.5.
  • Upgrade VS 2008 unit-test projects to VS 2010 SP1 and then re-target them to .NET Framework 3.5
  • Run unit tests that target the .NET Framework 3.5 from Visual Studio 2010 SP1 on your local machine.
  • Run unit tests that target the .NET Framework 3.5 using mstest.exe from the command prompt.
  • Run unit tests on a VS 2010 SP1 build agent as part of a build.

The capabilities listed above also enable developers to write unit tests, and integration tests for SharePoint 2010 applications using Visual Studio 2010 SP1.

The following walkthrough covers the steps required to re-target various unit-test projects to .Net Framework 3.5

pagesnap…”

With the multi-targeting goodness that is VS2010, I found it weird that you couldn’t create .Net 3.5 targeted unit tests. I actually thought it was a weirdness on my machine at first… Well in VS2010 SP1 that weirdness has been resolved.

On a related note, I’ve been running VS2010 SP1 for close to a week now and “it just seems to work.” I love it when that happens…. :)

Friday, October 01, 2010

Interested in PEX & MOLES? Wish you could go to a five hour workshop on them? Here’s the next best thing…

Cesar de la Torre - BLOG - Recorded PEX & MOLES Workshop

“Last summer (July 2010) we delivered in Madrid a nice PEX & MOLES workshop. The speaker was Peli de Halleux, from MICROSOFT RESEARCH.

If you are interested in Unit Testing, Mocking, etc., you should take a look at it!

It was a great workshop and we recorded it, so now we just published it on Channel9. Here you have the links! :-)

…”

Channel 9 - Microsoft PEX/MOLES & advanced Unit-Testing aspects 1/3, Microsoft PEX/MOLES & advanced Unit-Testing aspects 2/3, Microsoft PEX/MOLES & advanced Unit-Testing aspects 3/3

“Pex enables parameterized unit testing for .NET: given a unit test with parameters. Pex generates inputs that achieves high code coverage. Moles is a framework that allows to isolate unit tests from environment dependencies: Moles allows to replace any .NET method with a delegate, even when the method is static, non-virtual or in a sealed type.

Pex and Moles work on any .NET applications. Pex and Moles supports .NET v2.0, v3.5, v4.0, VS2008 and VS2010.

The learning objectives of this class are:

  • Understand and write unit tests
  • Use Moles to isolate unit tests
  • Write Pex parameterized unit tests

image…”

I’m starting to see PEX & MOLES pick up some traction… From what I’ve seen it looks interesting.

 

Related Past Post XRef:
Think you can’t unit test ASP.Net? Here’s a tutorial for one way, using the power of Pex and Moles
Playing with Pex is just a web browser away at www.pexforfun.com

Pex 2010 (aka Pex 0.90.50303.0) now available on MSDN Subscribers Downloads
Pex license updated – You can now use it in commercial projects
Pex 0.5 Released - Your Parameterized Unit Test Buddy