Skip to content

Commit

Permalink
add slow test category and ability to exclude them
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Mar 14, 2017
1 parent 91b00e2 commit 9851ec2
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<maven.compiler.target>1.${java.level}</maven.compiler.target>
<workflow.version>1.14</workflow.version>
<assertj.version>3.6.2</assertj.version>
<!-- by default we run all tests. But you can set this property to org.jenkinsci.plugins.zanata.SlowTest to exclude slow tests -->
<exclude.test.group />
</properties>

<name>Zanata Plugin</name>
Expand Down Expand Up @@ -297,6 +299,7 @@
<!-- We use late property evaluation (@{argLine}) so that surefire
will pick up the argLine set by jacoco:prepare-agent. -->
<argLine>@{argLine}</argLine>
<excludedGroups>${exclude.test.group}</excludedGroups>
</configuration>
</plugin>

Expand Down
27 changes: 27 additions & 0 deletions src/test/java/org/jenkinsci/plugins/zanata/SlowTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2016, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jenkinsci.plugins.zanata;

/**
* JUnit test category marker.
*/
public interface SlowTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import java.util.concurrent.Future;


import org.jenkinsci.plugins.zanata.SlowTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.jvnet.hudson.test.WithoutJenkins;
import org.xml.sax.SAXException;

Expand All @@ -32,6 +34,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;

@Category(SlowTest.class)
public class ZanataCLIInstallTest extends WithJenkins {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import java.io.IOException;
import java.util.List;

import org.jenkinsci.plugins.zanata.SlowTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.Mockito;

import hudson.model.AbstractProject;
Expand All @@ -27,6 +29,7 @@
* @author Patrick Huang
* <a href="mailto:[email protected]">[email protected]</a>
*/
@Category(SlowTest.class)
public class ZanataSyncStepTest extends WithJenkins {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

import java.io.IOException;

import org.jenkinsci.plugins.zanata.SlowTest;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.jvnet.hudson.test.TestBuilder;

import com.github.tomakehurst.wiremock.junit.WireMockRule;
Expand All @@ -29,6 +31,7 @@
* <a href="mailto:[email protected]">[email protected]</a>
*/
// TODO this will fail on windows
@Category(SlowTest.class)
public class ZanataSyncStepWithZanataTest extends WithJenkins {
private static final int FIVE_MINUTES = 1000 * 60 * 5;
@Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

import java.io.IOException;

import org.jenkinsci.plugins.zanata.SlowTest;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.TestBuilder;

Expand All @@ -31,6 +33,7 @@
import io.restassured.http.Header;
import io.restassured.specification.RequestSpecification;

@Category(SlowTest.class)
public class ZanataWebhookJobTriggerTest {
private static final Header JSON_CONTENT_TYPE =
new Header(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import static org.assertj.core.api.Assertions.assertThat;

import org.jenkinsci.plugins.workflow.structs.DescribableHelper;
import org.jenkinsci.plugins.zanata.SlowTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import hudson.model.FreeStyleProject;
import hudson.util.Secret;

@Category(SlowTest.class)
public class ZanataWebhookProjectPropertyTest extends WithJenkins {

@Test
Expand Down

0 comments on commit 9851ec2

Please sign in to comment.