xunit

how to use xUnit and FsCheck with IoC and mocking in F#

∥☆過路亽.° 提交于 2019-12-04 06:40:46
问题 I want to write unit tests F# using property base testing technic. however I came across several obstacle. Code I want to test is in C# Domain objects come from EF i.e. no constructors only mutable properties sut is a class that will require a lot of constructor injections. Their number will change quite frequently as we add new functions. We do not want to change old tests when we add new parameter to constructor. sut already exists and is working so changing it pattern to take only one

CasperJs + jenkins : when a test fails, how to retrieve all information on this test

爷,独闯天下 提交于 2019-12-04 05:17:21
Well , I would like to know how to get back the information of a test failed in jenkins. Here the result of my folder (fr) (it displays 22 min. but in parallel it's 3min) : Here the description of the test failed -jenkins- : Here the description of the test failed -casper- : So my problem is jenkins displays only the message of the test failed, and I would like to have also useful information as line and code (in fact there is the console output but it's not convenient-> I've changed my mine, it is, see xUnit with Jenkins: how to display colors in the Build Console Output? , but I still want

VS2015 Code Coverage not working with tests in ASP.NET Core 1.0 (formerly known as ASP.NET 5)

五迷三道 提交于 2019-12-04 04:43:51
I have a an ASP.NET Core 1.0 (previously known as ASP.NET 5) solution with a couple of Class Library (Package)'s and an ASP.NET MVC6 project. I have a test library using the new XUnit 2.0 which supports Core 1.0. However, for some reason my code coverage is producing zero results when running it on all of my tests which are passing. By default, ASP.NET Core 1.0 projects are built in-memory by the runtime and no artifacts are persisted to disk. So in the settings I enabled "Produce all outputs on build" for each project in the solution. Now when I build I see the pdb and dll files being output

How to run XUnit test using data from a CSV file

余生颓废 提交于 2019-12-04 04:18:36
问题 Is there a way to run a data driven XUnit test using a CSV file as the data source? I've tried Cavity.Data.XUnit , but it's no longer compatible with the newest version of XUnit . So far, I've only been able to achieve this using Excel files, but I need to change them to CSV instead. Any help is greatly appreciated. An example: [Theory] [ExcelData(@"Settings\TestFileParam.xls", "Select url, username, password, from TestData")] //^Replace with a CSV file instead public void Tester_Method

Visual Studio 2015 Test Explorer does not see XUnit dnx traits

别来无恙 提交于 2019-12-04 03:04:09
问题 The Visual Studio 2015 Test Explorer does not recognize my test traits. When I add this to a test in a DNX project: [Trait("Category", "Test")] the test still shows up in the Test Explorer under the No Traits group (when grouping tests by Traits). 回答1: Looks like this is already logged as an issue: VS 2015 Bugs - Traits and Project Grouping in Test Explorer #485 来源: https://stackoverflow.com/questions/32258618/visual-studio-2015-test-explorer-does-not-see-xunit-dnx-traits

How do I skip specific tests in xUnit based on current platform

时光毁灭记忆、已成空白 提交于 2019-12-03 22:06:35
I have an assembly that I've built on Windows I want to run the xUnit tests on mono in Linux. However, I have found that while 400 of these tests can run (in order), that certain tests either hang the xUnit runner, or bring it down entirely. I don't care if certain tests are not able to run on Linux, certain tests are to do with the DTC and some unmanaged gumph that we don't need to support there. What I do want however, is to apply an ignore to those tests, and have the fact that the test was ignored flagged properly in the build output. The question can be boiled down to I guess a number of

VS 2013 MSTest vs nUnit vs xUnit

我怕爱的太早我们不能终老 提交于 2019-12-03 16:52:00
问题 I realize there have been a LOT of questions on this topic but somehow I haven't found one that addressed my needs. My team is looking to start automated Unit testing our application. We have never done it before and nobody on the team has much experience with it. I have been asked to research and find a framework for automating our Unit Testing. So far, I have narrowed the choices down to MSTest, NUnit and xUnit . All across the internet, I read negative reviews about MSTest but it seems the

Unit Testing Azure Functions and .csx Files

≡放荡痞女 提交于 2019-12-03 14:58:11
Azure Functions abstract plenty of dependencies like queue libraries and Azure Tables. So from a Unit Test dependencies mocking perspective, there is less coding effort (and accordingly less maintenance). Assuming we are developing locally using Visual Studio 2015 How can I unit test (not interested in integration test) a single Azure Function? Preferably in xUnit, however, any framework would do. How can I unit test a function in a .csx file in general? As it stands, it's not really possible to unit test those files. For that reason (and a number of others), we have switched to a different

What's the idiomatic way to verify collection size in xUnit?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 14:15:50
问题 I have in my test suite a test that goes something like this: [Fact] public void VerifySomeStuff() { var stuffCollection = GetSomeStuff(); Assert.Equal(1, stuffCollection.Count()); } This test works as I expect, but when I run it xUnit prints a warning: warning xUnit2013: Do not use Assert.Equal() to check for collection size. However, no alternative is suggested in the warning, and a google search takes me to the source code in xUnit for the test that verifies this warning is printed. If

Dependency Injection with XUnit and ASP.NET Core 1.0

…衆ロ難τιáo~ 提交于 2019-12-03 13:02:29
I am trying to figure out how I can use dependency injection with XUnit. My goal is to be able to inject my ProductRepository into my test class. Here is the code I am trying: public class DatabaseFixture : IDisposable { private readonly TestServer _server; public DatabaseFixture() { _server = new TestServer(TestServer.CreateBuilder().UseStartup<Startup>()); } public void Dispose() { // ... clean up test data from the database ... } } public class MyTests : IClassFixture<DatabaseFixture> { DatabaseFixture _fixture; public ICustomerRepository _repository { get; set; } public MyTests