1 | <!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
---|
2 | <html>
|
---|
3 | <!-- Standard Head Part -->
|
---|
4 | <head>
|
---|
5 | <title>NUnit - GuiCommandLine</title>
|
---|
6 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
---|
7 | <meta http-equiv="Content-Language" content="en-US">
|
---|
8 | <link rel="stylesheet" type="text/css" href="nunit.css">
|
---|
9 | <link rel="shortcut icon" href="favicon.ico">
|
---|
10 | </head>
|
---|
11 | <!-- End Standard Head Part -->
|
---|
12 |
|
---|
13 | <body>
|
---|
14 |
|
---|
15 | <!-- Standard Header for NUnit.org -->
|
---|
16 | <div id="header">
|
---|
17 | <a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
|
---|
18 | <div id="nav">
|
---|
19 | <a href="http://www.nunit.org">NUnit</a>
|
---|
20 | <a class="active" href="index.html">Documentation</a>
|
---|
21 | </div>
|
---|
22 | </div>
|
---|
23 | <!-- End of Header -->
|
---|
24 |
|
---|
25 | <div id="content">
|
---|
26 |
|
---|
27 | <h2>NUnit Command Line Options</h2>
|
---|
28 | <p>The forms interface may be run with or without the name of a file containing
|
---|
29 | tests on the command line. If the program is started without any file
|
---|
30 | specified, it automatically loads the most recently loaded assembly.</p>
|
---|
31 | <p><b>Note:</b> Options that take values may use an equal sign, a colon or a space
|
---|
32 | to separate the option from its value.</p>
|
---|
33 | <p><b>Note:</b> Under the Windows operating system, options may be prefixed by either
|
---|
34 | a forward slash or a hyphen. Under Linux, a hyphen must be used. Options that
|
---|
35 | take values may use an equal sign, a colon or a space to separate the option
|
---|
36 | from its value.</p>
|
---|
37 | <h4>Run without loading an Assembly</h4>
|
---|
38 | <p>To suppress loading of the most recent assembly, use the <b>/noload</b> switch:
|
---|
39 | <pre class="programtext"> nunit /noload</pre>
|
---|
40 | </p>
|
---|
41 | <h4>Specifying an Assembly</h4>
|
---|
42 | <p>The other option is to specify an assembly or project file name on the command
|
---|
43 | line. The following will start the forms interface with the assembly
|
---|
44 | nunit.tests.dll:
|
---|
45 | <pre class="programtext"> nunit nunit.tests.dll</pre>
|
---|
46 | </p>
|
---|
47 | <p>The following will start the forms interface loading the same assembly through
|
---|
48 | its Visual Studio project definition:
|
---|
49 | <pre class="programtext"> nunit nunit.tests.csproj</pre>
|
---|
50 | </p>
|
---|
51 | <p>Assuming an NUnit test project has been created containing the assembly, the
|
---|
52 | following will again load nunit.tests.dll:
|
---|
53 | <pre class="programtext"> nunit nunit.tests.nunit</pre>
|
---|
54 | </p>
|
---|
55 | <h4>Specifying an Assembly and a Fixture</h4>
|
---|
56 | <p>
|
---|
57 | When specifying a a fixture, you must give the full name of the test fixture
|
---|
58 | along with the containing assembly. For example, to load only the
|
---|
59 | NUnit.Tests.AssertionTests in the nunit.tests.dll assembly use the following
|
---|
60 | command:
|
---|
61 | <pre class="programtext"> nunit /fixture:NUnit.Tests.AssertionTests nunit.tests.dll</pre>
|
---|
62 | </p>
|
---|
63 | <p>The name specified after the <b>/fixture</b> option may be that of a TestFixture
|
---|
64 | class, or a namespace. If a namespace is given, then all fixtures under that
|
---|
65 | namespace are loaded. This option may be used with Visual Studio or NUnit
|
---|
66 | projects as well.</p>
|
---|
67 |
|
---|
68 | <h4>Specifying Test Categories to Include or Exclude</h4>
|
---|
69 | <p>NUnit provides CategoryAttribute for use in marking tests as belonging to
|
---|
70 | one or more categories. Categories may be included or excluded in a test run
|
---|
71 | using the <b>/include</b> or <b>/exclude</b> options. The following command
|
---|
72 | starts the gui with only the tests in the BaseLine category selected:
|
---|
73 | <pre class="programtext"> nunit myassembly.dll /include:BaseLine</pre>
|
---|
74 | </p>
|
---|
75 | <p>The following command selects all tests <b>except</b> those in the Database
|
---|
76 | category:
|
---|
77 | <pre class="programtext"> nunit myassembly.dll /exclude:Database</pre>
|
---|
78 | </p>
|
---|
79 | <p>
|
---|
80 | Multiple categories may be specified on either option, by using commas to
|
---|
81 | separate them.
|
---|
82 | <p><b>Note:</b> At this time, the /include and /exclude options may not be
|
---|
83 | combined on the command line.</p>
|
---|
84 | <!--
|
---|
85 | <h4>Specifying the Version of the CLR</h4>
|
---|
86 |
|
---|
87 | <p>Most applications are written to run under a specific version of the CLR.
|
---|
88 | A few are designed to operate correctly under multiple versions. In either case,
|
---|
89 | it is important to be able to specify the CLR version to be used for testing.</p>
|
---|
90 |
|
---|
91 | <p>When only one version of the CLR is used, the config files for nunit and
|
---|
92 | nunit-console may be set up to specify that version. As a more convenient
|
---|
93 | alternative when switching CLRs, you may use the provided <b>clr.bat</b>
|
---|
94 | command to specify the version under which NUnit should run.</p>
|
---|
95 |
|
---|
96 | <p>For example, to run the gui under the RTM version of
|
---|
97 | the .Net 2.0 framework, use:</p>
|
---|
98 |
|
---|
99 | <pre class="programtext"> clr net-2.0 nunit</pre>
|
---|
100 |
|
---|
101 | <p>The <b>clr.bat</b> file is located in the NUnit <b>bin</b> directory. You may
|
---|
102 | put this on your path, or copy it to a convenient location. Enter <b>clr /?</b>
|
---|
103 | for a list of options.</p>
|
---|
104 |
|
---|
105 | <p><b>Note:</b> If you use a <startup> section in the config file, it takes
|
---|
106 | precedence over this option.</p>
|
---|
107 |
|
---|
108 | <p><b>Note:</b> This command is specific to the Microsoft .Net
|
---|
109 | framework. The Mono framework provides other means to specify the version
|
---|
110 | to be used when running a command and the NUnit Windows interface does
|
---|
111 | not currently run under Mono.</p>
|
---|
112 | -->
|
---|
113 |
|
---|
114 | <h4>Load and Run All Tests</h4>
|
---|
115 | Normally, nunit only loads an assembly and then waits for the user to click
|
---|
116 | on the Run button. If you wish to have the tests run immediately, use the <b>/run</b>
|
---|
117 | option:
|
---|
118 | <pre class="programtext"> nunit nunit.tests.dll /run</pre>
|
---|
119 | </p>
|
---|
120 | <h4>Load and Run Selected Tests</h4>
|
---|
121 | To load and immediately rerun the last selected tests, use the <b>/runselected</b>
|
---|
122 | option:
|
---|
123 | <pre class="programtext"> nunit nunit.tests.dll /runselected</pre>
|
---|
124 | </p>
|
---|
125 | <p><b>Note:</b> If no selection has been saved, this option works just like <b>/run</b>.
|
---|
126 | <h4>Specifying which Configuration to Load</h4>
|
---|
127 | <p>When loading a Visual Studio project or an NUnit project, the first
|
---|
128 | configuration found will be loaded by default. Usually this is Debug. The
|
---|
129 | configuration loaded may be controlled using the <b>/config</b> switch. The
|
---|
130 | following will load the Release configuration of the nunit.tests.dll:
|
---|
131 | <pre class="programtext"> nunit nunit.tests.csproj /config:Release</pre>
|
---|
132 | </p>
|
---|
133 | <p><b>Note:</b> This option has no effect when loading an assembly directly.</p>
|
---|
134 | <h4>Specifying Multiple Assemblies</h4>
|
---|
135 | <p>The forms interface does <b>not</b> currently provide for specifying more than
|
---|
136 | one assembly on the command line. Multiple-assembly projects must be loaded by
|
---|
137 | specifying the name of a Visual Studio solution file or an NUnit test project.</p>
|
---|
138 | <h4>Clearing the ShadowCopy Cache</h4>
|
---|
139 | <p>The <b>/cleanup</b> option erases the shadow copy cache and exits.
|
---|
140 | <h4>Displaying Help</h4>
|
---|
141 | <p>The <b>/help</b> or <b>/?</b> option displays a message box containing a brief
|
---|
142 | help message.</p>
|
---|
143 |
|
---|
144 | </div>
|
---|
145 |
|
---|
146 | <!-- Submenu -->
|
---|
147 | <div id="subnav">
|
---|
148 | <ul>
|
---|
149 | <li><a href="index.html">NUnit 2.5.10</a></li>
|
---|
150 | <ul>
|
---|
151 | <li><a href="getStarted.html">Getting Started</a></li>
|
---|
152 | <li><a href="assertions.html">Assertions</a></li>
|
---|
153 | <li><a href="constraintModel.html">Constraints</a></li>
|
---|
154 | <li><a href="attributes.html">Attributes</a></li>
|
---|
155 | <li><a href="runningTests.html">Running Tests</a></li>
|
---|
156 | <ul>
|
---|
157 | <li><a href="nunit-console.html">Console Runner</a></li>
|
---|
158 | <li><a href="nunit-gui.html">Gui Runner</a></li>
|
---|
159 | <ul>
|
---|
160 | <li id="current"><a href="guiCommandLine.html">Command-Line</a></li>
|
---|
161 | <li><a href="mainMenu.html">Main Menu</a></li>
|
---|
162 | <li><a href="contextMenu.html">Context Menu</a></li>
|
---|
163 | <li><a href="settingsDialog.html">Settings Dialog</a></li>
|
---|
164 | <li><a href="addinsDialog.html">Addins Dialog</a></li>
|
---|
165 | <li><a href="testProperties.html">Test Properties</a></li>
|
---|
166 | <li><a href="configEditor.html">Configuration Editor</a></li>
|
---|
167 | <li><a href="projectEditor.html">Project Editor</a></li>
|
---|
168 | </ul>
|
---|
169 | <li><a href="pnunit.html">PNUnit Runner</a></li>
|
---|
170 | <li><a href="nunit-agent.html">NUnit Agent</a></li>
|
---|
171 | <li><a href="runtimeSelection.html">Runtime Selection</a></li>
|
---|
172 | <li><a href="assemblyIsolation.html">Assembly Isolation</a></li>
|
---|
173 | <li><a href="configFiles.html">Configuration Files</a></li>
|
---|
174 | <li><a href="multiAssembly.html">Multiple Assemblies</a></li>
|
---|
175 | <li><a href="vsSupport.html">Visual Studio Support</a></li>
|
---|
176 | </ul>
|
---|
177 | <li><a href="extensibility.html">Extensibility</a></li>
|
---|
178 | <li><a href="releaseNotes.html">Release Notes</a></li>
|
---|
179 | <li><a href="samples.html">Samples</a></li>
|
---|
180 | <li><a href="license.html">License</a></li>
|
---|
181 | </ul>
|
---|
182 | </ul>
|
---|
183 | </div>
|
---|
184 | <!-- End of Submenu -->
|
---|
185 |
|
---|
186 |
|
---|
187 | <!-- Standard Footer for NUnit.org -->
|
---|
188 | <div id="footer">
|
---|
189 | Copyright © 2010 Charlie Poole. All Rights Reserved.
|
---|
190 | </div>
|
---|
191 | <!-- End of Footer -->
|
---|
192 |
|
---|
193 | </body>
|
---|
194 | </html>
|
---|