You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Sean Steimer <se...@gmail.com> on 2013/05/24 06:46:42 UTC

Possible to extend ServerSideTestsBase

Is there anyway to extend the ServerSideTestsCase class
in org.apache.sling.testing.samples.integrationtests?  From what I can
tell, the module doesn't build or deploy a tests jar, which means if you
want to extend this class from another module or project, you're forced to
copy and paste the class, which seems like an unnecessary burden to me.  If
I'm offbase here, let me know, but assuming I'm correct, would it make
sense to add an execution to have that module build a test jar, ie:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.2</version>
    <executions>
        <execution>
            <goals>
                <goal>test-jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Thus allowing other projects to take a test-dependency on that test jar and
extend the class so that you don;t need to duplicate that existing behavios
to set up your own ServerSideTests?

<dependency>
    <groupId>org.apache.sling</groupId>

<artifactId>org.apache.sling.testing.samples.integrationtests</artifactId>
    <version>1.0.6</version>
    <type>test-jar</type>
    <scope>test</scope>
</dependency>


--Sean

Re: Possible to extend ServerSideTestsBase

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Sean,

On Fri, May 24, 2013 at 6:46 AM, Sean Steimer <se...@gmail.com> wrote:
> Is there anyway to extend the ServerSideTestsCase class
> in org.apache.sling.testing.samples.integrationtests?  From what I can
> tell, the module doesn't build or deploy a tests jar, which means if you
> want to extend this class from another module or project, you're forced to
> copy and paste the class, which seems like an unnecessary burden to me...

That's correct - I wrote that class as an example, thinking that
people would want to add their own custom stuff anyway.

Basically, the only additional functionality w.r.t SlingTestBase is
checking that the junit servlet is ready...maybe that functionality
(check a series of URLs for expected results) could be added to the
SlingTestBase class instead.

Since I wrote that stuff I've been trying to avoid base classes for
providing that kind of functionality, and use utility classes instead,
to avoid "polluting" the inheritance tree. It might be worth looking
in that direction instead, i.e. transform SlingTestBase (keeping
backwards compatibility) and the ServerSideTestsCase into composable
utilities.

-Bertrand