سؤال

I have a list of several thousand NUnit tests that I want to run (generated automatically by another tool). (This is a subset of all of the tests, and changes frequently)

I'd like to be able to run these via NUnit-Console.exe. Unfortunately the /run option only takes a direct list of files which in my case would not fit on a single command line. I'd like it to pickup the list from a filename.

I appreciate that I could use categories, but the list I want to run changes frequently and so I'd prefer not to have to start changing source code.

Does anyone know if there is a clean way to get NUnit to run my specified tests? (I could break it down into a series of smaller calls to NUnit-console with a full command line, but that's not very elegant)

(If it's not possible, maybe I should add it as an NUnit feature request.)

هل كانت مفيدة؟

المحلول

Had a reply from Charlie Poole (from NUnit development team), that this is not currently possible but has been added as a feature request for NUnit 2.6

نصائح أخرى

I see what you're saying, but like you say you can run a single fixture from the command line.

nunit-console /fixture:namespace.fixture tests.dll

How about generating all the tests in the same fixture? Or place them all in the same assembly?

nunit-console tests.dll

As mentioned in the nunitLink, we need to mention the scenario/test case name. It simple but it has bit of a trick in it. Directly mentioning the test case name will not serve the purpose and you will end up with the 0 testcases executed. We need to write the exact path for the same.

I don't know how it works for other languages but using c# I have found a solution. Whenever we create a feature file corresponding feature.cs file get's created in Visual Studio. Click on the featureFileName.feature.cs and look for namespace and keep it aside(Part 1)

namespace MMBank.Test.Features

Scroll a bit down you will get the class name. Note that as well and keep it aside(Part 2)

public partial class HistoricalTransactionFeature

Keep scrolling down, you will see the code which nunit understands for execution basically.

[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("TC_1_A B C D")]
[NUnit.Framework.CategoryAttribute("MM_Bank")]

Below the code you can see the function/method name which will most likely be TC_1_ABCD(certain parameters)

public virtual void TC_1_ABCD(string username, string password, string visit)

You will be having multiple such methods based on no. of scenarios you have in your feature file. Note the method(test case) which you want to execute and keep it aside(Part 3)

Now collate all the parts with dots. Finally you will land up with something like this,

MMBank.Test.Features.HistoricalTransactionFeature.TC_1_ABCD

This is it. Similarly you can create the test case names from multiple feature files and stack them up in text file. Every test case name should be in different line. For command you can browse through above nunit link for execution using command prompt.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top