Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #52 from zanata/functest-categories
Browse files Browse the repository at this point in the history
Introduce Categories to the functional tests
  • Loading branch information
Patrick Huang committed Jul 17, 2013
2 parents 72079ed + c18b33a commit 2e8d40a
Show file tree
Hide file tree
Showing 35 changed files with 737 additions and 78 deletions.
6 changes: 3 additions & 3 deletions functional-test/pom.xml
Expand Up @@ -62,7 +62,7 @@
<!-- on jenkins, this needs to be set to empty - so that cargo can shutdown. see http://stackoverflow.com/questions/1096642/tomcat-failed-to-shutdown -->
<cargo.debug.jvm.args> -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787 -Xnoagent -Djava.compiler=NONE</cargo.debug.jvm.args>
<!-- this property can be used to control what test needs to be run by failsafe -->
<include.test.patterns>**/*TestSuite.java</include.test.patterns>
<include.test.patterns>**/AggregateTestSuite.java</include.test.patterns>
</properties>

<dependencies>
Expand Down Expand Up @@ -403,8 +403,8 @@
<!--<echo>-Dzanata.client.version=maven client version to use. Currently: ${zanata.client.version}</echo>-->
<echo>-Dzanata.sample.projects.basedir=${project.build.testOutputDirectory}/sample-projects</echo>
<echo>-Dcargo.debug.jvm.args : If not set by default will listen to port 8787. Need to set to empty on jenkins</echo>
<echo>-Dinclude.test.patterns=test filter pattern. Can be used to control what test to run. Default is **/*TestSuite.java.</echo>
<echo>-Dwebdriver.type=run tests in htmlUnit, chrome or firefox. For chrome, see also webdriver.chrome.* Default is htmlUnit.</echo>
<echo>-Dinclude.test.patterns=test filter pattern. Can be used to control what test to run. Default is **/*AggregateTestSuite.java.</echo>
<echo>-Dwebdriver.type=run tests in htmlUnit, chrome or firefox. For chrome, see also webdriver.chrome.* Default is chrome.</echo>
<echo>-Dwebdriver.display=display to run test browser in, for Xnest or otherwise. Default is :0.</echo>
<echo>-Dwebdriver.chrome.bin=full path to chrome binary.</echo>
<echo>-Dwebdriver.chrome.driver=full path to chromedriver binary.</echo>
Expand Down
@@ -0,0 +1,42 @@
/*
* Copyright 2013, 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.zanata.feature;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.zanata.feature.account.RegisterTestSuite;
import org.zanata.feature.administration.AdministrationTestSuite;
import org.zanata.feature.glossary.GlossaryTestSuite;
import org.zanata.feature.security.SecurityTestSuite;
import org.zanata.feature.startNewProject.CreateSampleProjectTestSuite;
import org.zanata.feature.versionGroup.VersionGroupTestSuite;

@RunWith(Suite.class)
@Suite.SuiteClasses({
RegisterTestSuite.class,
AdministrationTestSuite.class,
GlossaryTestSuite.class,
SecurityTestSuite.class,
CreateSampleProjectTestSuite.class,
VersionGroupTestSuite.class
})
public class AggregateTestSuite {
}
@@ -0,0 +1,33 @@
/*
* Copyright 2013, 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.zanata.feature;
/**
* Interface for the execution of the Basic Acceptance Tests (BAT) category.
*
* Tests in this category exercise features only so far as to demonstrate that the feature works,
* and perhaps have a single handled negative case.
* BAT suites should not exceed an agreed interval (e.g. approximately 10 minutes) in order to
* maintain a positive GitHub workflow.
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
* @see "http://junit.org/javadoc/4.9/org/junit/experimental/categories/Categories.html"
*/
public interface BasicAcceptanceTest { }
@@ -0,0 +1,34 @@
/*
* Copyright 2013, 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.zanata.feature;

import org.junit.experimental.categories.Categories;
import org.junit.runner.RunWith;

/**
* Extend the full test suite, but filter by the Basic Acceptance Test category
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Categories.class)
@Categories.IncludeCategory(BasicAcceptanceTest.class)
public class BasicAcceptanceTestSuite extends AggregateTestSuite {
}
@@ -0,0 +1,33 @@
/*
* Copyright 2013, 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.zanata.feature;
/**
* Interface for the execution of the Concordion Tests category.
*
* Tests in this category exercise features to a limited point,in order to validate the feature
* in a given use case and generate what is, effectively, a user manual.
* These tests are of a low priority due to the specific system requirements, e.g. actions which
* result in screenshots require a single display environment.
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
* @see "http://junit.org/javadoc/4.9/org/junit/experimental/categories/Categories.html"
*/
public interface ConcordionTest { }
@@ -0,0 +1,34 @@
/*
* Copyright 2013, 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.zanata.feature;

import org.junit.experimental.categories.Categories;
import org.junit.runner.RunWith;

/**
* Filter by the Concordion Test category
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Categories.class)
@Categories.IncludeCategory(ConcordionTest.class)
public class ConcordionTestSuite extends AggregateTestSuite {
}
31 changes: 31 additions & 0 deletions functional-test/src/test/java/org/zanata/feature/DetailedTest.java
@@ -0,0 +1,31 @@
/*
* Copyright 2013, 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.zanata.feature;
/**
* Interface for the execution of the detailed tests category.
*
* Tests that fall under this category exercise features more so than the Basic Acceptance Tests
* (BAT), but are time constrained and are as such not in the "Long" test collection.
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
* @see "http://junit.org/javadoc/4.9/org/junit/experimental/categories/Categories.html"
*/
public interface DetailedTest { }
@@ -0,0 +1,14 @@
package org.zanata.feature;

import org.junit.experimental.categories.Categories;
import org.junit.runner.RunWith;

/**
* Extend the full test suite, but filter by the Detailed Test category
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Categories.class)
@Categories.IncludeCategory(DetailedTest.class)
public class DetailedTestSuite extends AggregateTestSuite {
}
@@ -1,11 +1,33 @@
/*
* Copyright 2013, 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.zanata.feature.account;

import org.hamcrest.Matchers;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import org.zanata.feature.DetailedTest;
import org.zanata.page.account.RegisterPage;
import org.zanata.util.ResetDatabaseRule;
import org.zanata.util.rfc2822.InvalidEmailAddressRFC2822;
Expand All @@ -18,6 +40,7 @@
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Theories.class)
@Category(DetailedTest.class)
public class InvalidEmailAddressTest {
@ClassRule
public static ResetDatabaseRule resetDatabaseRule = new ResetDatabaseRule();
Expand Down
Expand Up @@ -20,12 +20,14 @@
*/
package org.zanata.feature.account;

import lombok.extern.slf4j.Slf4j;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.zanata.feature.BasicAcceptanceTest;
import org.zanata.feature.DetailedTest;
import org.zanata.page.HomePage;
import org.zanata.page.account.RegisterPage;
import org.zanata.util.rfc2822.InvalidEmailAddressRFC2822;
Expand All @@ -40,8 +42,8 @@
/**
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@Slf4j
public class RegisterDetailedTest
@Category(DetailedTest.class)
public class RegisterFullTest
{
@ClassRule
public static ResetDatabaseRule resetDatabaseRule = new ResetDatabaseRule();
Expand All @@ -67,6 +69,7 @@ public void before()
}

@Test
@Category(BasicAcceptanceTest.class)
@Ignore("Captcha prevents test completion")
public void registerSuccessful()
{
Expand Down
Expand Up @@ -20,23 +20,19 @@
*/
package org.zanata.feature.account;

import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.zanata.util.ResetDatabaseRule;

/**
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
RegisterDetailedTest.class,
RegisterFullTest.class,
UsernameValidationTest.class,
ValidEmailAddressTest.class,
InvalidEmailAddressTest.class
})
public class RegisterTestSuite
{
@ClassRule
public static ResetDatabaseRule resetDatabaseRule = new ResetDatabaseRule();
}
Expand Up @@ -22,10 +22,12 @@

import org.hamcrest.Matchers;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import org.zanata.feature.DetailedTest;
import org.zanata.page.account.RegisterPage;
import org.zanata.util.ResetDatabaseRule;
import org.zanata.workflow.BasicWorkFlow;
Expand All @@ -36,6 +38,7 @@
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Theories.class)
@Category(DetailedTest.class)
public class UsernameValidationTest
{
@ClassRule
Expand Down

0 comments on commit 2e8d40a

Please sign in to comment.