Merge pull request #3389 from lambdageek/bug-43099
[mono.git] / mcs / tools / nunit-lite / nunit-lite-console / Console.cs
1 // ***********************************************************************
2 // Copyright (c) 2009 Charlie Poole
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 // ***********************************************************************
23
24 using System;
25 using System.IO;
26 using NUnitLite.Runner;
27 using NUnit.Framework.Internal;
28
29 namespace NUnitLite
30 {
31     public class Console
32     {
33         // The main program executes the tests. Output may be routed to
34         // various locations, depending on the arguments passed.
35         //
36         // Arguments:
37         //
38         //  Arguments may be names of assemblies or options prefixed with '/'
39         //  or '-'. Normally, no assemblies are passed and the calling
40         //  assembly (the one containing this Main) is used. The following
41         //  options are accepted:
42         //
43         //    -test:<testname>  Provides the name of a test to be exected.
44         //                      May be repeated. If this option is not used,
45         //                      all tests are run.
46         //
47         //    -out:PATH         Path to a file to which output is written.
48         //                      If omitted, Console is used, which means the
49         //                      output is lost on a platform with no Console.
50         //
51         //    -full             Print full report of all tests.
52         //
53         //    -result:PATH      Path to a file to which the XML test result is written.
54         //
55         //    -explore[:Path]   If specified, list tests rather than executing them. If a
56         //                      path is given, an XML file representing the tests is written
57         //                      to that location. If not, output is written to tests.xml.
58         //
59         //    -noheader,noh     Suppress display of the initial message.
60         //
61         //    -wait             Wait for a keypress before exiting.
62         //
63         //    -include:categorylist 
64         //             If specified, nunitlite will only run the tests with a category 
65         //             that is in the comma separated list of category names. 
66         //             Example usage: -include:category1,category2 this command can be used
67         //             in combination with the -exclude option also note that exlude takes priority
68         //             over all includes.
69         //
70         //    -exclude:categorylist 
71         //             If specified, nunitlite will not run any of the tests with a category 
72         //             that is in the comma separated list of category names. 
73         //             Example usage: -exclude:category1,category2 this command can be used
74         //             in combination with the -include option also note that exclude takes priority
75         //             over all includes
76         public static int Main(string[] args)
77         {
78             var runner = new TextUI();
79             runner.Execute(args);
80             
81             return (runner.Failure ? 1 : 0);
82         }
83     }
84 }