Click here to Skip to main content
13,152,321 members (39,141 online)
Click here to Skip to main content
Add your own
alternative version

Stats

2.6K views
1 bookmarked
Posted 7 Jan 2016

Contest. Yet another testing framework

, 7 Jan 2016
Rate this:
Please Sign up or sign in to vote.
Introducing contest. The new testing framework for .NET.

Intro

In this short article I'll give you a brief introduction to contest, a new testing framework for .NET. I'll highlight its main features, advantages over existing frameworks and provide some links for those who wants to get their hands dirty.
This isn't, by any means, a complete guide or a walk thru on how to use contest. For one of those, you should go to contest's main page on github or to intro to contest, for a walk thru on how to create, build and run tests using this framework.

Background

I assume that the reader have some working experience with at least one mayor unit testing framework (Being NUnit, MSTest, and alike).

What is contest?

Contest is a minimalist, convention based, testing framework for .NET. It's open source (under MIT license) and runs on Linux, Mac and Windows. It comes bundled with a fast console test runner and supports a wide range of testing styles that go from fluent assertions to BDD and everything in between. Its syntax is short and right to the point, which (in some cases) allows you to write test cases that can be read by end users. Down below you can see an example of that:

// Fluent Assertions
_ when_order_ammount_exceeds_1000_shipping_cost_should_be_free =
    assert => That(ThousandDollarsOrder.ShippingCost).Is(0);

// BDD style
_ when_order_ammount_exceeds_1000_shipping_cost_should_be_free =
    expect => ThousandDollarsOrder.ShippingCost.ToBe(0)

// * note: I'm using one liners for the sake of brevity.

Advantages over other testing frameworks

  • Is conventions based, so no need for noisy annotations.
  • Supports multiple testing styles right out of the box (Fluent, BDD, etc.).
  • Flexible console test runner.
  • Assembly level setup/teardown.
  • Lightweight

Who uses contest

Most contest's users are .NET devs working on Linux and Mac, writing their code on Text Editors (like Vi or Sublime) and using mono as their primary runtime. Of course most applications are deployed to production environments running Windows, but as of now, the console test runner is really slow on Windows systems (about 10x slower compared to Ubuntu or OSX 10). I'm working on that, let see how it goes...

Why do we need another testing framework?

If you are running on Windows, using Visual Studio, ReSharper and all that stuff, you probably don't need another testing framework. I've been using NUnit for more than a decade by now, and it's a great peace of software. Although, if you are doing .NET on Linux, working with Vi (or any second class editor available on that platform ;)) you may find in contest a more flexible alternative to NUnit, which in my opinion, was designed to be used from GUI runners. (I know about the NUnitConsole, but in my opinion is completely fine tool for build servers but not so good for Red, Green, Refactor cycles).
Another aspect a like a lot about constest is the short syntax, when working with text editors, concise syntax is king.

Console test runner highlights

  • Wildcard filtering
  • Re-Run failing tests
  • Find slow tests
  • It's easy to attach to the Visual Studio's Debugger.
  • List failing tests

Limitations

  • Lacks of Visual Studio integration (Hence, no debugger out of the box).
  • Lacks of GUI runners.
  • Small user base.
  • Although you can debug your tests, it's a craftsman process (Attach by hand only).

How do I get Contest?

You can get contest from nuget or github.
Although, if you want the latest and greatest, you should always go github straight.

Want to know more about contest?

As of now, all of the action happens on github . That's the place to go.

Is contest the ultimate testing framework?

No is not. Is just alternative for those doing .NET on UNIX systems. While it can be used on Windows, I guess the lack of Visual Studio integration or GUI runners, is a no go for most .NET Devs. (Which is completely fine, not so long ago, it would be a deal breaker for me, too).

License

Contest is licensed under MIT. Which in short means give me credit not liabilities.

Want to start hacking right away?

That great! Just go to Contest's intro page on github. There, you will find a starting project that will let you try contests without installing or configuring anything. Just fork the repo and follow the instructions.

Disclaimer

Keep in mind this is alpha software. If you enjoy being on the bleeding edge, you will be more than fine. But if you are looking for a rock solid, bullet proof, stable version, you may have to wait a couple of months (if that ever happens).

Thanks for reading and let me know if you have any question.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author


You may also be interested in...

Pro

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170924.2 | Last Updated 7 Jan 2016
Article Copyright 2016 by Alejandro Miralles
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid