nunit

How to run Google Chrome with Selenium RC?

我的梦境 提交于 2019-12-17 07:00:35
问题 I am trying to test my site with Selenium RC + Nunit + asp.net. I can get my tests to work in Firefox,Safari,opera,IE 8 but not google chrome. I put this in for the browser arugment selenium = new DefaultSelenium(Server, ServerPort, "*chrome", DomainURL); This always loads up Firefox though and not good chrome. 回答1: If I remember correctly, " *chrome " is used to launch a special mode of Firefox (a mode in which your application has more privilegies -- with less security restrictions) ; so,

NUnit Specflow how to share a class instance for all tests

╄→гoц情女王★ 提交于 2019-12-17 06:14:24
问题 I am using Specflow with NUnit and Selenium and want to share instance of driver across all tests. I can do do this up to feature level with FeatureContext but can't see anything for all tests. I am aware that this is probably not the right way to go but I want to know if there is a way. Please help with example(s). Thanks 回答1: There are a few ways to do this. Most are covered on this page What I personally would probably do is define a SeleniumContext class and require this class in all my

Unit testing and checking private variable value

依然范特西╮ 提交于 2019-12-17 04:28:53
问题 I am writing unit tests with C#, NUnit and Rhino Mocks. Here are the relevant parts of a class I am testing: public class ClassToBeTested { private IList<object> insertItems = new List<object>(); public bool OnSave(object entity, object id) { var auditable = entity as IAuditable; if (auditable != null) insertItems.Add(entity); return false; } } I want to test the values in insertItems after a call to OnSave: [Test] public void OnSave_Adds_Object_To_InsertItems_Array() { Setup();

Compare equality between two objects in NUnit

穿精又带淫゛_ 提交于 2019-12-17 04:16:08
问题 I'm trying to assert that one object is "equal" to another object. The objects are just instances of a class with a bunch of public properties. Is there an easy way to have NUnit assert equality based on the properties? This is my current solution but I think there may be something better: Assert.AreEqual(LeftObject.Property1, RightObject.Property1) Assert.AreEqual(LeftObject.Property2, RightObject.Property2) Assert.AreEqual(LeftObject.Property3, RightObject.Property3) ... Assert.AreEqual

Can NUnit Console Runner report failed tests on the fly?

五迷三道 提交于 2019-12-14 03:57:25
问题 nunit-console seems to work like this (params: /nologo /wait /labels ... ) It outputs only the label for each test when a test is started, like so: ***** Our.Tests.Bla ... here come some Console.WriteLine // Note that in case Our.Tests.Bla fails, nothing is reported here immediately ***** Our.Tests.Blub ... here come some Console.WriteLine ***** Our.Tests.Foo ... here come some Console.WriteLine If any test fails, it reports the test failures only at the end of the complete run. Normally this

Problem with matching setup in Moq

非 Y 不嫁゛ 提交于 2019-12-14 02:20:18
问题 I've been using Moq for the past week or so and haven't had any issues until today. I'm having a problem with getting VerifyAll() to properly match the setup of my mock. I'm currently writing unit tests for my application's API. Here's how the application is structured: API <==> Service <==> DAO <==> Database With this in mind, I'm mocking the service object and then constructing an API object using the mocked service. I've written a number of unit tests already without problem up until now.

How do I unit test for machine specific behaviour?

旧城冷巷雨未停 提交于 2019-12-14 02:08:04
问题 I am testing a static method that builds a URL string after checking proxies and hostnames and all kinds of things. This method internally relies on the static flag System.Net.Sockets.Socket.OSSupportsIPv6 . Because it's static, I cannot mock this dependency. EDIT: (This is simplified down a lot... I can't modify the structure of the method with the flag to accept a true/false). On XP development machines, the method under question returns a predictable string result (in this case, http:/

NUnit not running Suite tests

这一生的挚爱 提交于 2019-12-14 00:18:47
问题 I've created a test suite in NUnit that references several distinct unit test fixtures in various assemblies. I've pretty much used the example code from NUnit's docs: namespace NUnit.Tests { using System; using NUnit.Framework; using System.Collections; public class AllTests { [Suite] public static IEnumerable Suite { get { ArrayList suite = new ArrayList(); suite.Add(new VisionMap.DotNet.Tests.ManagedInteropTest.DotNetUtilsTest()); return suite; } } } } My goal is to add several tests to

Backwards compatibility with C# Reflection and NUnit Versions

徘徊边缘 提交于 2019-12-13 21:17:26
问题 I am using C# on the .NET 4.5 framework with Visual Studio 2015. I am attempting to plug NUnit support into an automated test system that was built around MSUnit tests. As part of the system, I need to find methods marked with TestAttribute and TestCaseAttribute in provided .dll files using Reflection. Currently this system has NuGet packages installed for NUnit version 3.2.1. Question: is there a way to detect these attributes on tests that were created using older versions of NUnit? For

NUnit Server Web interface

孤者浪人 提交于 2019-12-13 19:18:48
问题 I'm searching for a kind of NUnit server with web interface, where I can start my NUnit test while on vacation or on the road... Is there any setup that can realise my idea or do I need to develop something? All I found so far was set up NUnit on multiple machines, as I searched for remote control or web interface. Kind regards bnz 回答1: A continuous integration tool such as JetBrains TeamCity can provide automated NUnit testing as part of a new build. It is possible to manually start new