---
title: "Ad hoc Unit Tests with Snippet Compiler"
url: "https://osherove.com/blog/2008/2/21/ad-hoc-unit-tests-with-snippet-compiler.md"
canonical: "https://osherove.com/blog/2008/2/21/ad-hoc-unit-tests-with-snippet-compiler.html"
published: "2008-02-21T17:21:37"
updated: "2008-02-21T17:21:37"
tags: ["Agile", "Cool Tools", "Unit Testing"]
author: "Roy Osherove"
description: "If you're a fan of snippet compiler (if you're not you should seriously check it out)Travis Illig published a little template for writing Typemock Isolator test inside this handy little tool. the reasons you'd need a…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Ad hoc Unit Tests with Snippet Compiler

By Roy Osherove February 21, 2008 In [Agile](https://osherove.com/blog/category/agile), [Cool Tools](https://osherove.com/blog/category/cool-tools), [Unit Testing](https://osherove.com/blog/category/unit-testing)

**Historical article** · Originally published February 21, 2008; technical details may be outdated.

If you're a fan of [snippet compiler](http://www.sliver.com/dotnet/SnippetCompiler/) (if you're not you should seriously check it out)Travis Illig [published a little template](http://www.paraesthesia.com/archive/2008/02/21/template-for-quick-typemock-testing.aspx) for writing [Typemock Isolator](http://typemock.com/) test inside this handy little tool.

the reasons you'd need a specialized template in the first place to write these kinds of tests in snippet compiler:

1) Typemock Isolator uses the .NET profiling APIs to work its magic, so the .net process running your tests need to have a couple of environment variables enabled to work

2) His code template actually creates and runs a new process that triggers nunit-console.exe with the path of the current code you just wrote in snippet compiler allowing you to effecively write and run unit tests in snippet compiler!

3) the nunit-console process will already have the env. vars as mentioned in the first item set to it.

Travis' template will work for anything nunit can run, not just typemock isolator tests, which is pretty cool.

[Full info and download here.](http://www.paraesthesia.com/archive/2008/02/21/template-for-quick-typemock-testing.aspx)

## More in Agile

[All posts in Agile](https://osherove.com/blog/category/agile)

- Feb 24, 2008

    ### [Project White and a cool debugging tip](https://osherove.com/blog/2008/2/24/project-white-and-a-cool-debugging-tip.html)

- Feb 24, 2008

    ### [Dear Diary, Pair Programming is FUN!](https://osherove.com/blog/2008/2/24/dear-diary-pair-programming-is-fun.html)

- Feb 14, 2008

    ### [Future of Mock Frameworks: AEIS - Abstract Expectations & Isolation Syntax](https://osherove.com/blog/2008/2/14/future-of-mock-frameworks-aeis-abstract-expectations-amp-iso.html)

- Feb 4, 2008

    ### [Mock vs. MockObject + Typemock Blog: Tips, Tricks and important things to know](https://osherove.com/blog/2008/2/4/mock-vs-mockobject-typemock-blog-tips-tricks-and-important-t.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
