nunit-2.5

NUnit extension

孤街醉人 提交于 2019-12-29 08:43:06
问题 Hi All i have a question regarding NUnit Extension (2.5.10). What i am trying to do is write some additional test info to the database. For that i have created NUnit extension using Event Listeners. The problem i am experiencing is that public void TestFinished(TestResult result) method is being called twice at runtime. And my code which writes to the database is in this method and that leaves me with duplicate entries in the database. The question is: Is that the expected behaviour? Can i do

How to do exception handling with nunit and moq?

此生再无相见时 提交于 2019-12-23 11:55:18
问题 I am trying to use nunits new way of exception handling but I am finding it hard to find information on it and how to also use it with moq. I have right now moq that throws a exception on a mocked method but I don't know how to use nunit to catch it and look at it. 回答1: There's a few different ways to do it; I use Assert.Throws. var exception = Assert.Throws<YourTypeOfException>(()=> Action goes here); e.g. var exception = Assert .Throws<ArgumentNullException>(()=> new ChimpPuncher(null));

Nunit parameterised TestFixtures with parameters set at runtime?

大兔子大兔子 提交于 2019-12-21 17:25:05
问题 I'm interested in being able to instantiate multiple testfixtures with constructor arguments passed to it at runtime by a static method or property returning an IEnumerable. In Nunit 2.5 they introduced parameterised tests and test fixtures. These allow you to write a single test and run it with several inputs provided using the TestCase attribute, and write a single test class and instantiate multiple instances of it with different constructor arguments respectively. In addition to this, it

What happended to nunit extensions/rowtest?

非 Y 不嫁゛ 提交于 2019-12-21 03:17:47
问题 In NUnit 2.4.7, nunit.framework.extensions.dll was included which made it possible to do RowTests. When downloading the newest version (2.5.8) I can't find it. What happened to it? 回答1: Instead of using RowTest , you can use TestCase . A previous testing using RowTest would look like: [RowTest] [Row("foo", false)] [Row("", true)] public void Some_test(string value, bool expected) { // test } And the same thing with TestCase looks like this: [TestCase("foo", false)] [TestCase("", true)] public

Integrating NUnitTesting GUI to Visual studio 2012 and debugging Test Cases

為{幸葍}努か 提交于 2019-12-20 03:50:58
问题 I am using NUnit 2.5 as my unit testing framework for visual studio 2012 professional. I configured NUnit.exe to open NUnit GUI for testing my dlls. I am testing a dll called "BookStore.dll" which i generated by compiling my current class library project "BookStore" To configure nunit as my testing framework i set the following values in the BookStore library project properties window: Start External program: C:\Nunit\Nunit.exe Command line arguments : BookStore.dll working directory as : C:

NUnit, Neither Assert.Throws nor [ExpectedException] Catch Thrown Exception

橙三吉。 提交于 2019-12-11 07:35:10
问题 Before I start, I want to make it clear that I've already checked for solutions in both this question and this question. The Method to Test public static DataSet ExecuteDataSet(this SqlConnection connection, string sql) { if (null == connection || null == sql) { throw new ArgumentNullException(); } using (var command = connection.CreateCommand()) { // Code elided for brevity } } The Test Methods [Test] [ExpectedException(typeof(ArgumentNullException))] public void

ERROR: Caught exception [ERROR: Unsupported command [addSelection |]

核能气质少年 提交于 2019-12-11 01:24:42
问题 I am using selenium web driver with C# and on trying to select an item on the available list I am receiving an error as: ERROR: Caught exception [ERROR: Unsupported command [addSelection | Can someone help me with this? Any workaround? What I am trying is to select an item from a list which is on the left side and then click on the button (>) to move it to the right side. 回答1: You are getting the error because not everything in the IDE can be converted into the WebDriver API's. You have to

Can NUnit expect a timeout?

烈酒焚心 提交于 2019-12-08 19:42:18
问题 I would like to test a method that I am expecting to block in a specific situation. I tried a combination of the TimeoutAttribute and ExpectedExceptionAttribute : [Test] [Timeout(50), ExpectedException(typeof(ThreadAbortException))] public void BlockingCallShouldBlock() { this.SomeBlockingCall(); } Unfortunately this does not work as the ThreadAbortException I was reading about here seems to get caught by NUnit itself. Is there a way to expect timeouts (with NUnit)? 回答1: For a problem like

Using PartCover 2.3 with .NET 4.0 runtime?

心已入冬 提交于 2019-12-07 00:53:54
问题 I've successfully got PartCover 2.3 working with VS 2008 on my 64-bit machine. I'm now trying to get it to work with VS 2010 and NUnit 2.5.3. I've got NUnit using the correct CLR version, but I can't get PartCover to produce any output. All I get is an "empty" report XML file: <PartCoverReport date="2010-03-30T16:09:05.1009099+01:00" /> How do I get PartCover 2.3 (or 2.2, I guess) to work with NUnit 2.5.3 on .NET 4.0? 回答1: I have recently completed a portcover fork that will hook into the

NUnit. Passing parameters into teardown method

别来无恙 提交于 2019-12-05 21:24:22
问题 I'm using NUnit. I have my test method defined likeso: [Test] [TestCase("Fred", "Bloggs")] [TestCase("Joe", "Smith")] public void MyUnitTest(string firstName, string lastName) { ... } After a TestCase has finished, it goes into the TearDown Method. What'd like to do, is have those TestCase parameters that are passed into the test method but also passed into the TearDown method. Something like this: [TearDown] public void TearDown(string firstName, string lastName) { ... } I'm hoping that