Randoop.NET is an API fuzzing unit test generator for .NET libraries. It creates test cases by sequence of API method calls and it improves on random and static test generation by incorporating feedback during test generation.

Randoop is extremely easy to use:
  • point it at your asssembly
> randoop  /timelimit:10 System.Xml.dll
....
  • here is a typical generated test case:

//LAST ACTION: System.Xml.XmlConvert.Char ToChar(System.String)
//EXCEPTION: System.FormatException
using System.Xml;
using System;
public class RandoopTest1262
{
  public static int Main()
  {
    try
    {
      //BEGIN TEST
      System.DateTime v2 =
         (System.DateTime)(System.Array.CreateInstance(typeof(System.DateTime), 1))
         .GetValue(0);
      System.Xml.XmlDateTimeSerializationMode v3 = 
         System.Xml.XmlDateTimeSerializationMode.Local;
      System.String v4 = System.Xml.XmlConvert.ToString(v2, v3) ;
      System.Char v5 = System.Xml.XmlConvert.ToChar((System.String)v4) ;
      //END TEST
      System.Console.WriteLine("This was unexpected behavior
                                (expected an exception). Will exit with code 99.");
      return 99;
    }
    catch (System.FormatException e)
    {
      System.Console.WriteLine("//EXCEPTION:" + e.GetType().FullName);
      System.Console.WriteLine("This was expected behavior.
                                Will exit with code 100.");
      return 100;
    }
    catch (System.Exception e)
    {
      System.Console.WriteLine("//EXCEPTION:" + e.GetType().FullName);
      System.Console.WriteLine("//STACK TRACE:");
      System.Console.WriteLine(e.StackTrace);
      System.Console.WriteLine();
      System.Console.WriteLine("This was unexpected behavior.
                                Will exit with code 99.");
      return 99;
    }
  }
}
//REFASSEMBLY: C:\windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll
//REFASSEMBLY: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll



More information


The project is sponsored by the Research in Software Engineering (RiSE) team at Microsoft Research, Redmond.

Last edited Sep 9, 2010 at 1:53 AM by shuvendu, version 41