Created
November 22, 2011 23:52
-
-
Save fijiaaron/1387474 to your computer and use it in GitHub Desktop.
Running NUnit tests programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using NUnit.Core; | |
using NUnit.Framework.Constraints; | |
namespace oneshore.qa.testrunner | |
{ | |
class TestRunner | |
{ | |
public static void Main(String[] args) | |
{ | |
//get from command line args | |
String pathToTestLibrary = "C:\\dev\\oneshore.Tests.DLL"; | |
TestRunner runner = new TestRunner(); | |
runner.run(pathToTestLibrary); | |
} | |
public void run(String pathToTestLibrary) | |
{ | |
CoreExtensions.Host.InitializeService(); | |
TestPackage testPackage = new TestPackage(@pathToTestLibrary); | |
testPackage.BasePath = Path.GetDirectoryName(pathToTestLibrary); | |
TestSuiteBuilder builder = new TestSuiteBuilder(); | |
TestSuite suite = builder.Build(testPackage); | |
TestResult result = suite.Run(new NullListener(), TestFilter.Empty); | |
Console.WriteLine("has results? " + result.HasResults); | |
Console.WriteLine("results count: " + result.Results.Count); | |
Console.WriteLine("success? " + result.IsSuccess); | |
} | |
} |
Author
fijiaaron
commented
May 8, 2021
via email
Yes, this example only works for Nunit2.
On Fri, May 7, 2021 at 10:37 AM AhlamJelti ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hi sir , can i ask u please ? I 'm using nunit 3 and NUnit.Core work just
with Nunit 2 .. and i isued NUnit .engine.API but i still have problems ..
could you help me please ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/1387474#gistcomment-3735077>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA4NEKVYRTRIRMLJV3AMBLTMQJOLANCNFSM44KQ52FQ>
.
--
Aaron Evans
***@***.***
425-442-6974
linkedin <https://linkedin.com/in/aaronevans> . twitter
<https://twitter.com/fijiaaron> . github <https://github.com/fijiaaron> .
about.me <https://about.me/aaronevans>
<https://www.one-shore.com/?referer=aarone-signature>
Test Automation Training | Consulting | Development
<https://www.one-shore.com?referer=aarone-signature>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment