Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [eclipselink-dev] recommended ways to exclude tests from LRG/SRG

Hi Edwin,

 

in the eclipselink.jpa.wdf.test testsuite, we are using jUnit 4 and a custom test runner. The test runner looks for a @Skip annotation:

 

@Retention(RetentionPolicy.RUNTIME)

public @interface Skip {

 

    /**

     * The databases on which this test should be skipped. Default: skip on all databases

     */

    Class<? extends DatabasePlatform>[] databases() default {};

}

 

For example

 

@Test

@Skip(databases = MySQLPlatform.class)

public void testPersistFlock() {

 

...

}

 

skips "testPersistFlock" on MySQLPlatform.

 

In the jUnit-Eclipse plugin, the skipped tests show up as skipped (x-ed out):

 

 

 

Unfortunately we have not found a way to make the skipped tests show up in the XML reports produced

by the <junit> ant task and hence not in the html-reports.

 

 

Maybe that’s something to consider for eclipselink.jpa.test as well.

 

-Adrian

 

Adrian Görler

SAP AG

 

Pflichtangaben/Mandatory Disclosure Statements: http://www.sap.com/company/legal/impressum.epx

 

 

 

-----Ursprüngliche Nachricht-----
Von: eclipselink-dev-bounces@xxxxxxxxxxx [mailto:eclipselink-dev-bounces@xxxxxxxxxxx] Im Auftrag von Edwin Tang
Gesendet: Donnerstag, 21. Januar 2010 15:04
An: Dev mailing list for Eclipse Persistence Services
Betreff: RE: [eclipselink-dev] recommended ways to exclude tests from LRG/SRG

 

Actually, I encountered the same issue several days ago, I wanted to skip some tests on Derby. I tried option #1 and #3 Dies mentioned, but I chose to implement in method suite() like:

    public static Test suite() {

        ...

        // Derby does not support simple CASE

        if (!((Session) JUnitTestCase.getServerSession()).getPlatform().isDerby())

        {

            suite.addTest(new JUnitCriteriaSimpleTestSuite("simpleCaseInWhereTest"));

            suite.addTest(new JUnitCriteriaSimpleTestSuite("simpleCaseInSelectTest"));

        }

        ...

    }

 

Because,

Option #1: the JUnit report shows SUCCESS for the tests, which is not exactly true.

Option #3: the JUnit report shows FAILURE with the warning info for the tests, that is informative, but not good if we want clean results.

 

Let us discuss about this, and come up with a standardized solution.

 

Thanks,

Edwin

 

-----Original Message-----

From: Dies Koper [mailto:diesk@xxxxxxxxxxxxxxxxxxx]

Sent: Thursday, January 21, 2010 3:45 AM

To: Dev mailing list for Eclipse Persistence Services

Subject: Re: [eclipselink-dev] recommended ways to exclude tests from

LRG/SRG

 

 

Also, how do I skip a whole suite (TestModel)?

 

I'd like to skip the following one completely as Symfoware doesn't allow

spaces in table names so none of its tests will pass.

 

org.eclipse.persistence.testing.tests.tableswithspacesmodel.EmployeeWithSpacesTestModel

 

I can't put an isSymfoware() around the tests.add method in

TestRunModel.java because the session is not initialized at this moment.

 

Thanks,

Dies

 

 

On 21/01/2010 18:07, Dies Koper wrote:

> Hi,

> 

> What's the recommended way to skip tests in the LRG and SRG test sets

> that won't run on a platform because of a documented limitation (of

> either EclipseLink/platform class or the db/driver itself)?

> 

> I have been trying to follow what's being done so far but there seem to

> be different ways.

> 

> For example, we have simple returns with a log message:

> 

>      if (!(dbPlatform.isOracle() || dbPlatform.isMySQL() ||

> dbPlatform.isPostgreSQL() || dbPlatform.isSymfoware())) {

>          getServerSession().logMessage("Test testLeftTrimWithTrimChar

> skipped for this platform");

>          return;

>      }

> 

> And we have TestWarningExceptions:

> 

>      if (getSession().getPlatform().isTimesTen() ||

> getSession().getPlatform().isSymfoware()) {

>           throw new TestWarningException("This test is not supported on

> this platform.");

>       }

> 

> And Assert,assertFalse():

> 

>      Assert.assertFalse("Warning Sybase Driver does not work with

> DriverWrapper, testEMCloseAndOpen can't run on this platform.",

> JUnitTestCase.getServerSession().getPlatform().isSybase());

> 

> Are there any rules for when to use which?

> 

> Thanks,

> Dies

 

_______________________________________________

eclipselink-dev mailing list

eclipselink-dev@xxxxxxxxxxx

https://dev.eclipse.org/mailman/listinfo/eclipselink-dev

_______________________________________________

eclipselink-dev mailing list

eclipselink-dev@xxxxxxxxxxx

https://dev.eclipse.org/mailman/listinfo/eclipselink-dev


Back to the top