|
1998 | 1998 |
|
1999 | 1999 | <!-- ==================== Test Profile System ==================== --> |
2000 | 2000 | <!-- |
2001 | | - Property-based test profiles for convenient, selective test execution. |
| 2001 | + Annotation-based test profiles for convenient, selective test execution. |
2002 | 2002 |
|
2003 | 2003 | Usage: ant test -Dtest.profile=<profile-name> |
2004 | 2004 |
|
2005 | 2005 | Precedence: test.entry > test.profile > default |
2006 | 2006 | If test.entry is set, the profile is ignored to maintain backward compatibility. |
2007 | 2007 |
|
2008 | | - Profile patterns are defined in test-profiles.properties test.profile properties |
2009 | | - to keep this file readable. |
| 2008 | + Profile membership is declared via @Category annotations on test classes. |
| 2009 | + CategoryScanner discovers matching tests at build time by scanning compiled |
| 2010 | + classes, so no separate file list needs to be maintained. |
2010 | 2011 | --> |
2011 | 2012 |
|
2012 | | - <!-- ================= Initialize Test Profile Property Values ================ --> |
2013 | | - |
2014 | | - <!-- We read test profile definitions from "test-profiles.properties.default" --> |
2015 | | - <!-- and also from "test-profiles.properties" if it exists. --> |
2016 | | - <!-- The values in "test-profiles.properties" have stronger preference. --> |
2017 | | - <!-- If you want to customize your build, you can either change the values --> |
2018 | | - <!-- directly in the default file, or create a new test-profiles.properties and --> |
2019 | | - <!-- set the values there. This way you don't have to change a file which --> |
2020 | | - <!-- is part of the original project source code. --> |
2021 | | - <!-- See "test-profiles.properties.default" in the top level directory for some --> |
2022 | | - <!-- property values you may customize. --> |
2023 | | - <property file="${user.home}/test-profiles.properties"/> |
2024 | | - <property file="test-profiles.properties"/> |
2025 | | - <property file="test-profiles.properties.default"/> |
2026 | | - |
2027 | 2013 | <!-- Macro to set test pattern based on profile name --> |
2028 | 2014 | <macrodef name="set-profile-pattern"> |
2029 | 2015 | <attribute name="profile"/> |
2030 | 2016 | <sequential> |
2031 | 2017 | <!-- Set test.name property based on the profile attribute --> |
2032 | 2018 |
|
2033 | | - <!-- For category-based profiles, record the category class so that the |
2034 | | - -test-categories target (which runs after test-compile) can run |
2035 | | - CategoryScanner and set test.name. --> |
| 2019 | + <!-- All profiles are now annotation-driven. Record the category class so |
| 2020 | + that the -test-categories target (which runs after test-compile) can |
| 2021 | + invoke CategoryScanner and set test.name. --> |
2036 | 2022 | <condition property="test.category.class" |
2037 | 2023 | value="org.apache.tomcat.categories.SmokeTest"> |
2038 | 2024 | <equals arg1="@{profile}" arg2="smoke"/> |
2039 | 2025 | </condition> |
2040 | | - |
2041 | | - <condition property="test.name" value="${test.profile.catalina}"> |
| 2026 | + <condition property="test.category.class" |
| 2027 | + value="org.apache.tomcat.categories.CatalinaTest"> |
2042 | 2028 | <equals arg1="@{profile}" arg2="catalina"/> |
2043 | 2029 | </condition> |
2044 | | - <condition property="test.name" value="${test.profile.coyote}"> |
| 2030 | + <condition property="test.category.class" |
| 2031 | + value="org.apache.tomcat.categories.CoyoteTest"> |
2045 | 2032 | <equals arg1="@{profile}" arg2="coyote"/> |
2046 | 2033 | </condition> |
2047 | | - <condition property="test.name" value="${test.profile.performance}"> |
| 2034 | + <condition property="test.category.class" |
| 2035 | + value="org.apache.tomcat.categories.PerformanceTest"> |
2048 | 2036 | <equals arg1="@{profile}" arg2="performance"/> |
2049 | 2037 | </condition> |
2050 | | - <condition property="test.name" value="${test.profile.tribes}"> |
| 2038 | + <condition property="test.category.class" |
| 2039 | + value="org.apache.tomcat.categories.TribesTest"> |
2051 | 2040 | <equals arg1="@{profile}" arg2="tribes"/> |
2052 | 2041 | </condition> |
2053 | | - <condition property="test.name" value="${test.profile.buildutil}"> |
| 2042 | + <condition property="test.category.class" |
| 2043 | + value="org.apache.tomcat.categories.BuildutilTest"> |
2054 | 2044 | <equals arg1="@{profile}" arg2="buildutil"/> |
2055 | 2045 | </condition> |
2056 | | - <condition property="test.name" value="${test.profile.integration}"> |
| 2046 | + <condition property="test.category.class" |
| 2047 | + value="org.apache.tomcat.categories.IntegrationTest"> |
2057 | 2048 | <equals arg1="@{profile}" arg2="integration"/> |
2058 | 2049 | </condition> |
2059 | 2050 | </sequential> |
|
0 commit comments