Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(test): Upgrade test harness to Kotlin and JUnit5
- Loading branch information
1 parent
360d720
commit 830876a
Showing
10 changed files
with
228 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
server/functional-test/src/test/java/org/zanata/feature/testharness/BasicAcceptanceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2018, 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.testharness | ||
|
||
import org.junit.jupiter.api.Tag | ||
import kotlin.annotation.Retention | ||
|
||
/** | ||
* 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. | ||
* Tests in this category provide a "review readiness" status for Github | ||
* Pull Requests, and must pass for said request to be accepted and merged. | ||
* | ||
* @author Damian Jansen [djansen@redhat.com](mailto:djansen@redhat.com) | ||
*/ | ||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FILE, | ||
AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, | ||
AnnotationTarget.PROPERTY_SETTER) | ||
@Retention | ||
@Tag("BasicAcceptancetest") | ||
annotation class BasicAcceptanceTest |
40 changes: 40 additions & 0 deletions
40
server/functional-test/src/test/java/org/zanata/feature/testharness/ComprehensiveTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2018, 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.testharness | ||
|
||
import org.junit.jupiter.api.Tag | ||
import kotlin.annotation.Retention | ||
|
||
/** | ||
* Interface for the execution of the Comprehensive Tests category. | ||
* | ||
* Tests in this category include as many tests as feasible covering boundaries, | ||
* negative paths and various other considerations. These act as an Early | ||
* Warning System for QA, and are wholly managed and maintained by QA. | ||
* | ||
* @author Damian Jansen [djansen@redhat.com](mailto:djansen@redhat.com) | ||
*/ | ||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FILE, | ||
AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, | ||
AnnotationTarget.PROPERTY_SETTER) | ||
@Retention | ||
@Tag("ComprehensiveTest") | ||
annotation class ComprehensiveTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
server/functional-test/src/test/java/org/zanata/util/LoggingExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2018, 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.util; | ||
|
||
import org.apache.log4j.LogManager; | ||
import org.apache.log4j.Logger; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.api.extension.TestInstancePostProcessor; | ||
|
||
public class LoggingExtension implements TestInstancePostProcessor { | ||
|
||
@Override | ||
public void postProcessTestInstance(Object testInstance, | ||
ExtensionContext context) throws Exception { | ||
Logger logger = LogManager.getLogger(testInstance.getClass()); | ||
// testInstance.getClass() | ||
// .getMethod("setLogger", Logger.class) | ||
// .invoke(testInstance, logger); | ||
} | ||
} |
54 changes: 0 additions & 54 deletions
54
server/functional-test/src/test/java/org/zanata/util/SampleDataExtension.java
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
server/functional-test/src/test/java/org/zanata/util/SampleDataExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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.util | ||
|
||
import org.junit.jupiter.api.extension.BeforeEachCallback | ||
import org.junit.jupiter.api.extension.ExtensionContext | ||
import org.zanata.util.SampleDataResourceClient.deleteExceptEssentialData | ||
import org.zanata.util.SampleDataResourceClient.makeSampleLanguages | ||
import org.zanata.util.SampleDataResourceClient.makeSampleProject | ||
import org.zanata.util.SampleDataResourceClient.makeSampleUsers | ||
import org.zanata.util.SampleDataResourceClient.setRateLimit | ||
import org.zanata.util.SampleDataResourceClient.userJoinsLanguageTeam | ||
|
||
/** | ||
* Create sample data for tests | ||
* | ||
* @see org.junit.jupiter.api.extension.Extension | ||
* | ||
* @author Patrick Huang [pahuang@redhat.com](mailto:pahuang@redhat.com) | ||
* @author Damian Jansen [djansen@redhat.com](mailto:djansen@redhat.com) | ||
*/ | ||
class SampleDataExtension : BeforeEachCallback { | ||
|
||
@Throws(Exception::class) | ||
override fun beforeEach(context: ExtensionContext) { | ||
deleteExceptEssentialData() | ||
makeSampleUsers() | ||
makeSampleLanguages() | ||
val locales = "fr,hi,pl" | ||
userJoinsLanguageTeam("translator", locales) | ||
userJoinsLanguageTeam("glossarist", locales) | ||
makeSampleProject() | ||
setRateLimit(ACTIVE_RATE_LIMIT, CONCURRENT_RATE_LIMIT) | ||
} | ||
|
||
companion object { | ||
val CONCURRENT_RATE_LIMIT = 20 | ||
val ACTIVE_RATE_LIMIT = 10 | ||
} | ||
} |
Oops, something went wrong.