My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
RunThrough  
A Quick Run Through for Gallio Users.
Featured
Updated Feb 4, 2010 by StephanMeyn

Introduction

To make use of the GTA, 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 GTA 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, GTA will create them and assign them to the Testplan. It then records the test result against that test case.

Installation

Run Time Files

There are three DLLs that need to be copied into the bin directory of the Gallio folder:

Invocation

The exporter works with the console runner Gallio.Echo. Gallio v3.0.5

Gallio.Echo.exe /extension:TestLinkAddOn,TlGallioAddon.dll  [unitTestAssembly]

Gallio v3.0.6

Gallio.Echo.exe /re:TestLinkAddOn,TlGallioAddon.dll   [unitTestAssembly]

If you are using the Gallio NAnt or MSBuild tasks, the process is similar. Refer to the documentation of these tasks for details. (http://blog.bits-in-motion.com/2008/05/announcing-gallio-v30-alpha-3.html)

TestLink Setup

In order for this to work you need to have in testlink:

  1. Enabled the API (see installation manual)
  2. Created an account for testing
  3. Created an ApiKey for this account
  4. Setup a test project
  5. Set up test suite(s) (top level test suite) for the test cases
  6. In the test project set up a test plan
  7. Optionally created test cases in the test suite and assigned to the test plan
  8. Have an active build defined in the testplan

Step 7 really is optionally because:

  1. You must make sure you name the test cases exactly as they are defined in your unit tests
  2. If you use advanced features such as contract verifiers and row tests in MBUnit you have to guess what these test cases will be named because they are dynamically generated
  3. If you don’t create test cases, GTA will do it for you – much easier

Unit Test setup

Write 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:

  • URL of the TestLink Api
  • UserName under which the test cases are authored
  • An ApiKey (provided by the testlink application (uses the name DevKey)
  • The test project name
  • The test plan in the test project
  • The test suite name that will contain the test cases

Example

using MbUnit.Framework;
using TlGallioAddOn;
using Meyn.TestLink;

namespace gallioAddOnSampleTests
{
    [TestFixture]
    [TestLinkFixture(
        Url = "http://localhost/testlink/lib/api/xmlrpc.php",
        ProjectName = "TestLinkApi",
        UserId = "admin",
        TestPlan = "Automatic Testing",
        TestSuite = "gallioAddOnSampleTests",
        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.

Note

Please make sure the fixture class is marked public. Gallio will run and execute classes no marked public but this adapter won't find the fixture.

There is a new set of binaries for Gallio V3.0.6

Limitations

This has been tested with Gallio & MBUnit V3.0.5 & V3.0.6, C# and Testlink V 1.8RC5.

It should work with VB.NET.

It may work with NUnit.

You use this code at your own risk.

Comment by trishk...@gmail.com, Apr 27, 2009

Hi there,

The example needs to be updated with the namespace: using Meyn.TestLink;

Please note that this tool will ONLY work with Gallio v3.0.5 and not later versions.

Comment by project member StephanMeyn, May 7, 2009

trishkoo thanks for the advice. A new version of binaries is available. It looks I'll have to recompile a new one every time a new gallio version comes out.

Comment by venkate...@gmail.com, Sep 2, 2010

Hi StephanMeyn?, Getting error message "XML-RPC server accepts POST request only" in browser. When I tried the above sample replacing the URL and other values I am getting the above error. Do you have any idea how to solve it.

Thanks in advance, Venkatesen

Comment by manoj.pa...@gmail.com, Oct 2, 2011

Hi Stephan, We are currently using testlink for our test case management and have a junit automation framework. So i was looking for an API that would allow me to report all the automation results to testlink. Do you have any API to do so? Any information on this is going to be highly appreciated. Thanks Manoj


Sign in to add a comment
Powered by Google Project Hosting