nunit

Underlying Provider Failed on Open

萝らか妹 提交于 2019-12-25 08:21:22
问题 I have a Test that i am running from NUnit but it keeps failing [Test] public void CheckTeamsExist() { UsersContext context = new UsersContext(); var count = context.Events.Count(); Assert.AreSame(true, count > 10); } The exact error message i am getting is QUBBasketballMVC.Tests.Controllers.TeamContextTest.CheckTeamsExist: System.Data.EntityException : The underlying provider failed on Open. ----> System.Data.SqlClient.SqlException : An attempt to attach an auto-named database for file C:

How to handle file upload in selenium in windows 7

那年仲夏 提交于 2019-12-25 06:37:26
问题 I am writing a script in selenium using webdriver and nunit to automate my web application. I have to upload file in my application. But unable to do it. The dialog opens while browse button is clicked, and upon selecting file the file is uploaded. Browse How can i do it in selenium? 回答1: Answer is already available on stack, still I am repeating: find the upload button, create webelement of this and follow this code: //open upload window upload.click(); //put path to your image in a

nunit-console crashes after running the tests

雨燕双飞 提交于 2019-12-25 04:18:06
问题 I'm using nunit-console for unit testing a Mono application on Debian. It runs all the tests and then crashes after reporting the failed tests. TestResult.xml is not generated. If I use nunit-console with either -out or -err argument, it runs the tests and then crashes before reporting the results. Another weird thing is that if I cut down the number of tests (from about 800 to 100) it sometimes wont crash. Throwing out even more testcases seems to decrease the chance of crashing. Platform:

Why are breakpoints in tests not hit?

左心房为你撑大大i 提交于 2019-12-25 03:55:23
问题 I have several NUnit tests in a test project that is part of a solution. I have a breakpoint in each test method. A "typical" one of these methods is: public void TestHHSInterface() { var HHSClient = IOC.container.Resolve<IHHSClient>(); var s = HHSClient.GetTestMessage("Duckbilled", "Platypus"); Assert.Greater(s.Value.Length, 0); } The tests run, as evidenced by what I see here: Is this normal that breakpoints are not hit? It seems that they are running, but that the results (passed 3, failed

Running tests with NUnit and Selenium 2.11.0 exception

让人想犯罪 __ 提交于 2019-12-25 02:21:00
问题 I'm trying to run some tests in C# with NUnit and Selenium 2. Steps I followed: I installed NUnit. I figure I can't have any errors here. I downloaded Selenium 2: I got the client from this link and the C# server from this one. Started the selenium server executing the following command: (i´m now doubting whether this step is necessary or not) java -jar C:\selenium-remote-control-2.11.0\selenium-server-2.11.0\selenium-2.11.0\selenium-server-standalone-2.11.0.jar When -using NUnit- I run a

running nunit tests (x86) with gallio

淺唱寂寞╮ 提交于 2019-12-25 01:46:17
问题 I am trying to run nunit tests with gallio. These tests run with nunit-console-x86.exe When I run them with nunit-console.exe, I am getting System.BadImageFormatException Running with Gallio.Echo.exe (installed the x86 bundle from gallio.org), I am getting the same exception. Is there a way to get gallio to use the nunit-console-x86.exe? I am running the command "C:\Program Files (x86)\Gallio\bin\Gallio.echo.exe" /r:IsolatedProcess "C:\projectdata.Tests.dll" and I am getting this exception:

Why is CSharpOptParse UsageBuilder failing due to an XPathException only when used in an NUnit test?

做~自己de王妃 提交于 2019-12-25 00:09:50
问题 What is the root cause of this issue? CSharpOptParse, XslTransform.Transform(...), or NUnit? What other equivalent library could I use instead, if this problem is unfixable, that is being actively supported? I'm using version 1.0.1 of CSharpOptParse which was last modified in Feb 2005. I've have the following class (simplified for this example of course) to use along with CSharpOptParse: public enum CommandType { Usage } public class Options { [OptDef(OptValType.Flag)] [LongOptionName("help")

Mocked method returning null when called from a different project

≡放荡痞女 提交于 2019-12-24 21:54:25
问题 I have this test class: using NSubstitute; using NUnit.Framework; using System; using System.Linq.Expressions; namespace MyTests { public class Tests { [Test] public void Test() { var companyBL = Substitute.For<ICompanyBL>(); companyBL.GetCompany(c => new { c.RegionID }).ReturnsForAnyArgs(new { RegionID = 4, }); var company = companyBL.GetCompany(c => new { c.RegionID }); var dataRetriever = new DataRetriever(companyBL); } } } and this code in another project: namespace MyTests { using System

Mock objects, nUnit, call log and log4net

会有一股神秘感。 提交于 2019-12-24 19:35:53
问题 A very often scenario of unit test is as follows: public void SetUp() { this.callLog = new StringBuilder(); } public void TestBuzzBar() { var bar = new Bar(new MockFoo(callLog)); bar.Buzz(17); Assert.AreEqual("MockFoo.Init(17) MockFoo.PrepareStuff MockFoo.DoTheJob ", callLog.ToString()); } ... with MockFoo implementing an IFoo interface by just appending strings a call log. It requires a lot of code handling with callLog in mocks. Is it a good idea to use log4net to collect call log? 回答1: To

什么是单元测试,集成测试,冒烟测试和回归测试?

左心房为你撑大大i 提交于 2019-12-24 18:30:05
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 什么是单元测试,集成测试,冒烟测试和回归测试? 它们之间有什么区别,我可以为每个工具使用哪些工具? 例如,我将JUnit和NUnit用于单元测试和集成测试。 有烟雾测试或回归测试工具吗? #1楼 我刚意识到的一个新的测试类别是: 金丝雀测试 Canary测试是在 LIVE 环境中 定期运行 的自动化无损测试,因此,如果测试失败,则确实发生了某些不良情况。 例如: LIVE中出现了只有在DEV / TEST中才可用的数据。 后台进程运行失败 用户可以登录吗 #2楼 单元测试:验证特定组件(即类)是否按设计创建或修改了功能。 该测试可以是手动的也可以是自动化的,但不会超出组件的范围。 集成测试:验证特定组件的交互是否按设计起作用。 集成测试可以在单元级别或系统级别执行。 这些测试可以是手动的也可以是自动化的。 回归测试:验证新缺陷是否未引入现有代码中。 这些测试可以是手动的也可以是自动化的。 根据您的SDLC(瀑布,卢布,敏捷等),特定的测试可以分阶段进行,也可以全部或多或少地同时进行。 例如,单元测试可能仅限于开发人员,然后开发人员将代码移交给测试人员进行集成和回归测试。 但是,另一种方法可能是让开发人员进行单元测试以及某种程度的集成和回归测试(使用TDD方法以及持续集成以及自动化的单元和回归测试)。 #3楼