rhysgodfrey / team-city-xunit-meta-runner

UNSUPPORTED - A Team City Meta Runner plugin to allow xUnit tests to be easily run
GNU General Public License v2.0
5 stars 5 forks source link

Allow multiple assemblies to be specified #1

Open rhysgodfrey opened 10 years ago

rhysgodfrey commented 10 years ago

Allow a specific list of assemblies, or possibly a wildcard specification of assemblies to run the tests on, without adding extra external dependencies to the project (e.g. MSBuild).

See comments from Alexander Batishchev (http://www.rhysgodfrey.co.uk/b/blog/archive/2014/10/09/xunit-plugin-for-teamcity)

abatishchev commented 10 years ago

Thanks for putting this into the backlog.

Currently I have a build step per assembly what seems a noise comparing to MSTest with single step.

I know xUnit doesn't support wildcards. I wish you did :)

Is it possible to execute the runner for each assembly in a list? Seeing no source code it sounds simple.

Dreamwalker666 commented 9 years ago

(I haven't tried this but I presume you are using the console runner, to execute xunit.)

Xunit supports an test.xunit xml file to be passed to the runner this supports multiple assemblies. Now I think you will be able to substitute this for the dll file you want to run instead.

<?xml version="1.0" encoding="utf-8"?> 
<xunit>
    <assemblies> 
        <assembly filename="" shadow-copy="true" /> 
    </assemblies> 
</xunit>

Which just means (if it works will try and get confirmation) you just need to update the plugin screens documentation :)

rhysgodfrey commented 9 years ago

@Dreamwalker666 yes the plugin is just calling the command line runner, with the path passed into the plugin and the -teamcity parameter (https://github.com/rhysgodfrey/team-city-xunit-meta-runner/blob/master/Plugin/server/metaRunners/MRPLUGIN_XUnitBuildRunnerPlugin.xml#L12).

I've not really seen the xunit xml files for running tests, but this looks like it could be a great workaround for the limitation with xunit :+1:

Is there any documentation on creating the files or running using the console runner - all I can find is: https://xunit.codeplex.com/wikipage?title=ProjectFileFormat

I've just given it a quick try with the XML snippet you provided, but couldn't get it to work (sure it's something simple I'm missing though :)). I had to add the xunit.*.dll files to the same directory as the XML file, then the console error gave the following error: System.BadImageFormatException: Could not load file or assembly 'tests.xunit' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Have you managed to get this working, guessing there might be something wrong with my XML file, or an extra command line argument is required?

Dreamwalker666 commented 9 years ago

I am currently using the .NET process runner in team city to run my tests. I have attached a copy of my config screen (v8.1 of team city ) tc

Now the xunit file it self just needs a path to the test dll files (which should be the same as entered on the plugin screen)

e.g.

<?xml version="1.0" encoding="utf-8"?> 
<xunit>
    <assemblies> 
        <assembly filename=" MyProjectFolder\Bin\Debug\MyProject.Test.dll." shadow-copy="true" /> 
    </assemblies> 
</xunit>

(The filename path will start from the VCS Root)
abatishchev commented 9 years ago

Why mess up with xml if it can be an ui for it?

rhysgodfrey commented 9 years ago

@abatishchev dealing with it using the UI would be the ideal situation, but this plugin is created as a Meta Runner (which is simple, but limited) rather than a full plugin.

Really all this plugin does is automate the installation of the xUnit console application on the build agents and call the standard Team City console runner.

There may be a way of running multiple assemblies by using something like powershell and calling xunit multiple times, but the XML option is a simpler work around.

Looks like a little after I put this together a xUnit meta runner to the JetBrains power pack (I should have thought of that, make these easier to find!), the UI suggests this can run multiple assemblies. I haven't had a chance to give it a go, but might be worth looking at.

Takes a slightly different approach, but should have a similar result, major difference is that version is currently using xUnit 1.9.x, whereas this is using the 2.0.x beta.

Dreamwalker666 commented 9 years ago

@rhysgodfrey nice find the fact it integrates dotcover as well is awesome