Add special TCK unit test runner to ignore these unit tests by default

and only run them when the TCK_TESTS property is set.
This commit is contained in:
Klaus Reimer 2013-02-24 02:34:44 +01:00
parent 74396d9405
commit 7df2071181
6 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*/
package de.ailis.usb4java;
import org.junit.internal.runners.JUnit38ClassRunner;
import org.junit.runner.Description;
import org.junit.runner.manipulation.Filter;
import org.junit.runner.manipulation.NoTestsRemainException;
/**
* Runner for TCK tests. TCK tests are only run when the property TCK_TESTS
* is set.
*
* @author Klaus Reimer (k@ailis.de)
*/
public class TCKRunner extends JUnit38ClassRunner
{
/**
* Constructor.
*
* @param testClass
* The test class.
* @throws NoTestsRemainException
* When no tests are to be run in this test class.
*/
public TCKRunner(final Class<?> testClass) throws NoTestsRemainException
{
super(testClass);
filter(new Filter()
{
@Override
public boolean shouldRun(Description description)
{
return System.getProperty("TCK_TESTS") != null;
}
@Override
public String describe()
{
return "TCK tests only when enabled";
}
});
}
}

View File

@ -23,6 +23,10 @@ import java.util.*;
import javax.usb.*;
import javax.usb.event.*;
import org.junit.runner.RunWith;
import de.ailis.usb4java.TCKRunner;
import junit.framework.TestCase;
/**
@ -37,6 +41,7 @@ import junit.framework.TestCase;
@SuppressWarnings("all")
@RunWith(TCKRunner.class)
public class DefaultControlPipeTestIRP extends TestCase
{
public void setUp() throws Exception

View File

@ -27,6 +27,10 @@ import javax.usb.*;
import javax.usb.event.*;
import javax.usb.util.StandardRequest;
import org.junit.runner.RunWith;
import de.ailis.usb4java.TCKRunner;
import junit.framework.TestCase;
/**
@ -39,6 +43,7 @@ import junit.framework.TestCase;
@SuppressWarnings("all")
@RunWith(TCKRunner.class)
public class HotPlugTest extends TestCase
{

View File

@ -4,6 +4,11 @@ import javax.usb.*;
import junit.framework.TestCase;
import junit.framework.Assert;
import javax.usb.util.*;
import org.junit.runner.RunWith;
import de.ailis.usb4java.TCKRunner;
import java.util.*;
/**
@ -37,6 +42,7 @@ import java.util.*;
@SuppressWarnings("all")
@RunWith(TCKRunner.class)
public class IrpTest extends TestCase
{

View File

@ -10,6 +10,11 @@ package javax.usb.tck;
*/
import javax.usb.tck.sigtest.*;
import org.junit.runner.RunWith;
import de.ailis.usb4java.TCKRunner;
import java.io.*;
import junit.framework.*;
@ -24,6 +29,7 @@ import junit.framework.*;
* @author Bob Rossi
*/
@SuppressWarnings("all")
@RunWith(TCKRunner.class)
public class SignatureTest extends TestCase
{
/**

View File

@ -26,6 +26,10 @@ import java.util.*;
import javax.usb.*;
import org.junit.runner.RunWith;
import de.ailis.usb4java.TCKRunner;
/**
* Usb Interface Policy Test
* <p>
@ -35,6 +39,7 @@ import javax.usb.*;
* @author Dale Heeks
*/
@SuppressWarnings("all")
@RunWith(TCKRunner.class)
public class UsbInterfacePolicyTest extends TestCase
{