[ 
https://issues.apache.org/jira/browse/SLING-5598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Egli updated SLING-5598:
-------------------------------
    Attachment: SLING-5598-discovery.patch
                SLING-5598-commons-testing.patch

Suggesting to use Junit Categories as those can easily be enabled/disabled via 
profiles ({{-PincludeSlowTests}}) or maven properties ({{mvn test 
-Dtest.categories=Slow}}) and thus would introduce a new category that could be 
used throughout Sling to mark slow tests:
{code}
package org.apache.sling.commons.testing.junit.categories;

/** JUnit Category for tests that are considered slow and
 * are thus only run when explicitly enabled (by default off) */
public interface Slow {
}
{code}
which would be applied as follows:
{code}
    @Category(Slow.class)
    @Test
    public void testPartitioning() throws Throwable {
        doTestPartitioning(true);
    }
{code}

The {{Slow}} category would be disabled by default in the pom (via 
{{maven-surefire-plugin/excludedGroups}}) and could be enabled with whatever 
means we agree upon, one suggestion could be to use a profile for that, eg 
{{mvn clean install -PincludeSlowTests}} (ie that profile would ensure {{Slow}} 
is not excluded).

Attaching the following:
* [^SLING-5598-commons-testing.patch]: contains the suggested new {{Slow}} 
category for {{o.a.s.commons.testing}}
* [^SLING-5598-discovery.patch]: applies {{Slow}} to discovery by marking the 
slowest tests (on a method basis mostly) with this category, resulting in the 
following speed-ups:
** discovery.commons: down from 3:54min to 49s: -80%
** discovery.base: down from 61s to 41s: -33%
** discovery.oak: down from 12:15min to 02:42min: -78%
** discovery.impl: down from 22min to 155sec: -88%

Will go back to [the list|http://markmail.org/message/yad5awqg53epk3ck] to 
discuss this suggestion. The idea is that this immediately speeds up the normal 
test run substantially (ca 31min). But of course it's not ideal to now have 
some of the heavier/longer tests run less frequent, thus as a separate step 
those tests marked with {{Slow}} should be checked to see if they could use 
virtual clocks or how they could otherwise be speed-up (tbd in separate 
tickets).
/cc [~bdelacretaz]

> Exclude slow tests by default with assume(sling.slow.tests.enabled) 
> --------------------------------------------------------------------
>
>                 Key: SLING-5598
>                 URL: https://issues.apache.org/jira/browse/SLING-5598
>             Project: Sling
>          Issue Type: Task
>          Components: Extensions
>    Affects Versions: Discovery Impl 1.2.6, Discovery Base 1.1.2, Discovery 
> Commons 1.0.10, Discovery Oak 1.2.6
>            Reporter: Stefan Egli
>            Assignee: Stefan Egli
>         Attachments: SLING-5598-commons-testing.patch, 
> SLING-5598-discovery.patch
>
>
> As suggested by [~bdelacretaz] on [the 
> list|http://markmail.org/message/yad5awqg53epk3ck] we should improve test 
> duration (ideally 1-2min per bundle max, 10-15min overall). While they are 
> not yet improved however, slow tests should be excluded by default and run 
> only if enabled explicitly. Here's an example {{@Before}} method to achieve 
> that:
> {noformat}
> @Before
> public void checkSlowTests() {
>     assumeNotNull(System.getProperty("sling.slow.tests.enabled"));
> }
> {noformat}
> and to enable the slow tests you do: {{mvn -Dsling.slow.tests.enabled=true 
> clean test}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to