Questions tagged [xunit2]

Related to the version 2 of XUnit

Related to the version 2 of XUnit: https://github.com/xunit/xunit/releases

64 questions
0
votes
0 answers

WebDriver does not dispose

I’m using the Microsoft Edge WebDriver to test inprivate browser windows but I’ve noticed 2 things: WebDriver process does not always end When running more than 1 at a time, taking screenshots often fail once the first web driver has been disposed…
Matt W
  • 11,753
  • 25
  • 118
  • 215
0
votes
0 answers

XUnit Test Orderer vs Parallel

I have a suite of system tests that are driven by XUnit (2.x). These run against a freshly deployed set of microservices. (I know many feel that tests shouldn't have an order dependency and should be independent, but what we have works well as a…
Pete Roberts
  • 118
  • 7
0
votes
0 answers

AutoFakeItEasyDataAttribute populates complex objects with test data but customized fixture won't

I have a complex object several levels deep. Marking my Xunit theory with this custom attribute and passing the complex object to the method as a parameter populates all the properties with test data…
W. Young
  • 357
  • 7
  • 18
0
votes
1 answer

xUnit's MemberData attribute does not work

I have a Test Project with xUnit framework net6.0 enable enable false
kintela
  • 1,283
  • 1
  • 14
  • 32
0
votes
1 answer

How to prevent xUnit from logging when use it from `dotnet test`?

It should be simple, but I am not able to make it. Setup .NET 6 class library xUnit 2.4.1 as a test framework Everything is nice. I am trying to execute all my unit tests before committing. If any unit test failed I will prevent the commit. I am…
Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
0
votes
1 answer

AutoFixture AutoDataAttribute Customization Beyond Derived Attribute

I am using the AutoDataAttribute class within AutoFixture.Xunit2 in a lot of projects. The recommended approach to add your own customizations seems to be a derived attribute like the following (note I am using FakeItEasy): public class…
Shawn
  • 869
  • 1
  • 9
  • 27
0
votes
0 answers

How to dispose after each test in parallel testing xunit?

My tests in Selenium Xunit 2.0 from different collection class run parallel and dispose method call once only. I want to call to dispose the method after each test run even if they run in parallel. [TestClass] public class Basic : IDisposable …
Gkm
  • 237
  • 1
  • 5
  • 19
0
votes
1 answer

Invalid cast exception Xunit deserialization error

When trying to run a test case that uses the xunit framework through Visual Studio I am currently getting the following error. System.InvalidCastException HResult=0x80004002 Message=Specified cast is not valid. …
ZoSal
  • 561
  • 4
  • 21
0
votes
2 answers

C# each attribute should execute the TestMethod

I have created a custom xUnit theory test DataAttribute named RoleAttribute: public class RoleAttribute : DataAttribute { public Role Role { get; set; } public RoleAttribute(Role role, Action method) { Role = role; …
user6410654
0
votes
1 answer

XUnit Testing using Autofac.Extras.Moq

I'm new in unit testing, Below is code for unit testing using xunit public class FloorManager { public List Floors { get; } public FloorManager() { Floors = new List(); SelectedFloor = -1; } …
Omkar
  • 15
  • 5
0
votes
1 answer

How to write test case for below method in controller

Need code to write xunit test case for ControllerApi I tried to inject Contructor from xunit test method, but it asking contructor value which I don't have in test method. Controller ItemApiController.cs public class ItemApiController :…
naresh
  • 1
  • 1
0
votes
1 answer

xUnit - What is the maximum number of parallel tests that can run in xUnit?

xUnit documentation does not specify any limits on the number of parallel tests - https://xunit.github.io/docs/running-tests-in-parallel.html
Delfin
  • 1
  • 4
0
votes
0 answers

How do I remove AfterMap from Automapper Profiles

I have a profile class where I am using AfterMap() method. My profile class has two constructor dependencies. Problem is that while I am unit testing I am mocking these dependencies but also I require the actual objects when I am doing integration…
Sharthak Ghosh
  • 576
  • 1
  • 9
  • 22
0
votes
0 answers

Wierd behavior when loading AutoMapper profiles for Unit Testing using xUnit 2

xUnit2 runs all tests in parallel, so for this reason I want to ensure that all my automapper profiles are loaded first, in order to get a successful mapping while running the tests. This is what I have done public static class…
Sharthak Ghosh
  • 576
  • 1
  • 9
  • 22
0
votes
1 answer

System.Configuration.ConfigurationErrorsException using xunit2 and automapper

I have been facing an unusual problem, in my unit test project I am getting this error, also the strange thing is some tests which normally pass, fail in next run. With this error I am also getting AutoMapperMappingExceptions, although I am trying…
Sharthak Ghosh
  • 576
  • 1
  • 9
  • 22