|
NUnitRunThrough
A Quick Run Through of the NUnit TestLink Adapter.
Featured What is the NUnit TestLink Adapter?The test link adapter is an Addin for the NUnit unit testing framework. It exports test results into Testlink, which is a test management application. IntroductionTo make use of the NUnit TestLink Adapter (NTA), you must first add a new attribute to each TestFixture. This attribute, called TestLinkFixture takes parameters that tell the adapter where to find the test cases to record results to. Typically the tests are run as part of a build script or a batch file. The NTA is an extension to the command line runner. When the tests have been run, the extension is called with the test results. The extension parses the results, loads the test assemblies that have been run and extracts the test link fixture. It then contacts Testlink to look for test cases with the same name as they test methods in the unit test. If the test case does not exist, NTA will create them and assign them to the Testplan. It then records the test result against that test case. InstallationRun Time FilesCopy all the DLLs into the AddIn directory of the NUnit folder: InvocationIn this example the console runner is used: Nunit-Console.exe [unitTestAssembly] TestLink SetupIn order for this to work you need to have in testlink:
Step 7 really is optionally because:
Unit Test setupWrite your test cases as you are used to. Then have the project reference TestLinkFixture.dll and add a Using Statement for it. Add the TestLinkFixture to your testfixture. The parameters are:
Example using NUnit.Framework;
using Meyn.TestLink;
namespace NunitAddOnSampleTests
{
[TestFixture]
[TestLinkFixture(
Url = "http://localhost/testlink/lib/api/xmlrpc.php",
ProjectName = "TestLinkApi",
UserId = "admin",
TestPlan = "Automatic Testing",
TestSuite = "nunitAddOnSampleTests",
DevKey = "ae28ffa45712a041fa0b31dfacb75e29")]
public class SampleFixture
{
[Test]
public void Test2Succeed()
{
Assert.IsTrue(true);
}
}
}Voila. This will create a test case named Test2Succeed and record test case result against it. LimitationsThis has been tested with NUnit V 2.5.2 & C# and Testlink V 1.8.2 It should work with VB.NET. You use this code at your own risk. |