xunit

Pass complex parameters to [Theory]

断了今生、忘了曾经 提交于 2019-11-26 19:44:28
Xunit has a nice feature : you can create one test with a Theory attribute and put data in InlineData attributes, and xUnit will generate many tests, and test them all. I want to have something like this, but the parameters to my method are not 'simple data' (like string , int , double ), but a list of my class: public static void WriteReportsToMemoryStream( IEnumerable<MyCustomClass> listReport, MemoryStream ms, StreamWriter writer) { ... } quetzalcoatl There are many xxxxData attributes in XUnit. Check out for example the PropertyData attribute. You can implement a property that returns

What is the JUnit XML format specification that Hudson supports?

拟墨画扇 提交于 2019-11-26 12:38:07
I have Hudson as continuous integration server and I want to use option 'Publish JUnit test result report'. But I don't use xUnit tools for testing, instead of that i have shell scripts which run tests and return results in simple format. I am thinking to make a script which transforms these results to the JUnit format. So i'm interesting how the JUnit file must look? Anders Lindahl I did a similar thing a few months ago, and it turned out this simple format was enough for Hudson to accept it as a test protocol: <testsuite tests="3"> <testcase classname="foo1" name="ASuccessfulTest"/>

Net Core: Execute All Dependency Injection in Xunit Test for AppService, Repository, etc

寵の児 提交于 2019-11-26 08:32:12
问题 I am trying to implement Dependency Injection in Xunit test for AppService. Ideal goal is to run the original application program Startup/configuration, and use any dependency injection that was in Startup, instead of reinitializing all the DI again in my test, thats the whole Goal in question. Update: Mohsen\'s answer is close. Need to update couple syntax/requirement errors to work. For some reason, original application works and can call Department App Service. However, it cannot call in

Visual Studio 2015 or 2017 does not discover unit tests

爷,独闯天下 提交于 2019-11-26 06:13:50
问题 EDIT 2016-10-19: The original question was about an issue specific to VS2015 CTP6 with the XUnit test runner. It\'s clear from the answers that there is a much broader issue with unit test discovery in Visual Studio which may occur in many different situations. I have cleaned up my question to reflect that. I have also included a script in my own answer that I still use to this day to solve similar problems when they appear. Many other answers have also proven helpful in better understanding

What is the JUnit XML format specification that Hudson supports?

久未见 提交于 2019-11-26 03:02:45
问题 I have Hudson as continuous integration server and I want to use option \'Publish JUnit test result report\'. But I don\'t use xUnit tools for testing, instead of that i have shell scripts which run tests and return results in simple format. I am thinking to make a script which transforms these results to the JUnit format. So i\'m interesting how the JUnit file must look? 回答1: I did a similar thing a few months ago, and it turned out this simple format was enough for Hudson to accept it as a