You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Haikal Saadh <sp...@gmail.com> on 2008/09/15 02:40:19 UTC

Neater way to include/exclude DAO tests?

Hi all.

I'm trying to figure out what the best way is to exclude DAO tests. The
reason for this being that not everyone who checks a project out may have
the credentials necessary to connect to the database.

At the moment, I have two profiles like this:

<profiles>
    <profile>
      <id>skip-dao-tests</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/WhatEverDaoTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>run-dao-tests</id>
      <activation>
        <property>
          <name>run.dao.tests</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        ...
      </dependencies>
    </profile>
</profiles>

This works fine, but it just seems like it's bloating the pom.

I could move the DAO tests to a new module, but then, I'd have two different
sets of cobertura/surefire reports for the same thing.

Any different approaches I can try? Or is this pretty much it?

Thanks.
-- 
View this message in context: http://www.nabble.com/Neater-way-to-include-exclude-DAO-tests--tp19485851p19485851.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Paul Benedict <pb...@apache.org>.
The idea of using a profile to exclude a wildcard set of classes is
the correct approach.

Paul

On Sun, Sep 14, 2008 at 7:40 PM, Haikal Saadh <sp...@gmail.com> wrote:
>
> Hi all.
>
> I'm trying to figure out what the best way is to exclude DAO tests. The
> reason for this being that not everyone who checks a project out may have
> the credentials necessary to connect to the database.
>
> At the moment, I have two profiles like this:
>
> <profiles>
>    <profile>
>      <id>skip-dao-tests</id>
>      <activation>
>        <activeByDefault>true</activeByDefault>
>      </activation>
>      <build>
>        <plugins>
>          <plugin>
>            <groupId>org.apache.maven.plugins</groupId>
>            <artifactId>maven-surefire-plugin</artifactId>
>            <configuration>
>              <excludes>
>                <exclude>**/WhatEverDaoTest.java</exclude>
>              </excludes>
>            </configuration>
>          </plugin>
>        </plugins>
>      </build>
>    </profile>
>    <profile>
>      <id>run-dao-tests</id>
>      <activation>
>        <property>
>          <name>run.dao.tests</name>
>          <value>true</value>
>        </property>
>      </activation>
>      <build>
>        <plugins>
>          <plugin>
>            <groupId>org.apache.maven.plugins</groupId>
>            <artifactId>maven-surefire-plugin</artifactId>
>          </plugin>
>        </plugins>
>      </build>
>      <dependencies>
>        ...
>      </dependencies>
>    </profile>
> </profiles>
>
> This works fine, but it just seems like it's bloating the pom.
>
> I could move the DAO tests to a new module, but then, I'd have two different
> sets of cobertura/surefire reports for the same thing.
>
> Any different approaches I can try? Or is this pretty much it?
>
> Thanks.
> --
> View this message in context: http://www.nabble.com/Neater-way-to-include-exclude-DAO-tests--tp19485851p19485851.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Stephen Connolly <st...@gmail.com>.
For a more build tool agnostic approach:

Have a test resource that gets the connection details filtered in

Then in your database tests, start each one with a Junit4 Assumption like

assumeThat(credentialsFromTestResource, is(not(nullValue()));

And now you can run all tests from your IDE too

-Stephen

On Monday, 15 September 2008, Dennis Lundberg wrote:

> A totally different way to do it is to run your DAO test cases against
> an embedded database like HSQLDB or perhaps Derby. We use HSQLDB for
> this with at file based database that gets created locally when the
> tests are run.
>
> I know this doesn't answer your question, I'm just thinking outside the
> box here :-)
>
> Haikal Saadh wrote:
> > Hi all.
> >
> > I'm trying to figure out what the best way is to exclude DAO tests. The
> > reason for this being that not everyone who checks a project out may have
> > the credentials necessary to connect to the database.
> >
> > At the moment, I have two profiles like this:
> >
> > <profiles>
> >     <profile>
> >       <id>skip-dao-tests</id>
> >       <activation>
> >         <activeByDefault>true</activeByDefault>
> >       </activation>
> >       <build>
> >         <plugins>
> >           <plugin>
> >             <groupId>org.apache.maven.plugins</groupId>
> >             <artifactId>maven-surefire-plugin</artifactId>
> >             <configuration>
> >               <excludes>
> >                 <exclude>**/WhatEverDaoTest.java</exclude>
> >               </excludes>
> >             </configuration>
> >           </plugin>
> >         </plugins>
> >       </build>
> >     </profile>
> >     <profile>
> >       <id>run-dao-tests</id>
> >       <activation>
> >         <property>
> >           <name>run.dao.tests</name>
> >           <value>true</value>
> >         </property>
> >       </activation>
> >       <build>
> >         <plugins>
> >           <plugin>
> >             <groupId>org.apache.maven.plugins</groupId>
> >             <artifactId>maven-surefire-plugin</artifactId>
> >           </plugin>
> >         </plugins>
> >       </build>
> >       <dependencies>
> >         ...
> >       </dependencies>
> >     </profile>
> > </profiles>
> >
> > This works fine, but it just seems like it's bloating the pom.
> >
> > I could move the DAO tests to a new module, but then, I'd have two
> different
> > sets of cobertura/surefire reports for the same thing.
> >
> > Any different approaches I can try? Or is this pretty much it?
> >
> > Thanks.
>
>
> --
> Dennis Lundberg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org <javascript:;>
> For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
>
>

Re: Neater way to include/exclude DAO tests?

Posted by Stephane-3 <mi...@yahoo.se>.
Lucky you, think twice before upgrading that Oracle server :-)



--
View this message in context: http://maven.40175.n5.nabble.com/Neater-way-to-include-exclude-DAO-tests-tp110827p5732983.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Dennis Lundberg <de...@apache.org>.
Hi

No, we use a very old version (8.something) of Oracle that doesn't
handle NULLs at all for CHAR or VARCHAR fields. If you insert null into
them it is magically transformed into an empty string '', thus solving
the sorting issue.

On 2012-11-24 08:38, Stephane-3 wrote:
> Hi Dennis,
> 
> Thanks for the feedback. I'm impressed by the fact that you succeeded in not
> using any different sql syntax for the different database servers out there.
> I'm faced with the ordering by "nulls first on MySql" vs "nulls last on
> Oracle" issue on resorted to a specific DAO method for Oracle with a native
> sql statement containing the "nulls first" clause. Haven't you been bitten
> by this one ? :-)
> 
> I posted on the Hibernate forum as it is more a Hibernate issue than a Maven
> one.
> 
> https://forum.hibernate.org/viewtopic.php?f=1&t=1024833
> 
> Kind Regards,
> 
> 
> 
> 
> --
> View this message in context: http://maven.40175.n5.nabble.com/Neater-way-to-include-exclude-DAO-tests-tp110827p5732802.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Stephane-3 <mi...@yahoo.se>.
Hi Dennis,

Thanks for the feedback. I'm impressed by the fact that you succeeded in not
using any different sql syntax for the different database servers out there.
I'm faced with the ordering by "nulls first on MySql" vs "nulls last on
Oracle" issue on resorted to a specific DAO method for Oracle with a native
sql statement containing the "nulls first" clause. Haven't you been bitten
by this one ? :-)

I posted on the Hibernate forum as it is more a Hibernate issue than a Maven
one.

https://forum.hibernate.org/viewtopic.php?f=1&t=1024833

Kind Regards,




--
View this message in context: http://maven.40175.n5.nabble.com/Neater-way-to-include-exclude-DAO-tests-tp110827p5732802.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Dennis Lundberg <de...@apache.org>.
On 2012-11-23 06:44, Stephane-3 wrote:
> Hello Dennis,

Hi Stephane

> I'm interested in how you set up your multi database servers with syntax
> specifics project.
> 
> Could you elaborate on that ?

As I explained in an earlier post, we have a couple of different .ddl
scripts that helps us set up a database from scratch for running tests.
These handle the differences in syntax between database vendors when it
comes to setting up the database.

Our current setup is:
- Derby for automatic unit testing
- MySQL for integration testing using an external test database on
another server. It is activated by a profile in the POM that redirects
all tests to that database instead of the embedded Derby one.
- MySQL or Oracle in production, depending on product

> I have a MySql based project and am now trying to port it on Oracle but some
> sql statements need specific syntax.

We do not use different SQL syntax for different databases in our Java
code - we use the same DAO implementations for all databases.

> It would be nice to inject some Oracle specific DAOs in the Spring context
> when the sql syntax requires iit.

Sorry, can't be of any help when it comes to Spring...

> Thanks for any direction tips !
> 
> 
> 
> 
> --
> View this message in context: http://maven.40175.n5.nabble.com/Neater-way-to-include-exclude-DAO-tests-tp110827p5732575.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Stephane-3 <mi...@yahoo.se>.
Hello Dennis,

I'm interested in how you set up your multi database servers with syntax
specifics project.

Could you elaborate on that ?

I have a MySql based project and am now trying to port it on Oracle but some
sql statements need specific syntax.

It would be nice to inject some Oracle specific DAOs in the Spring context
when the sql syntax requires iit.

Thanks for any direction tips !




--
View this message in context: http://maven.40175.n5.nabble.com/Neater-way-to-include-exclude-DAO-tests-tp110827p5732575.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Dennis Lundberg <de...@apache.org>.
We have Oracle for production as well. What we ended up with was 3 ddl
scripts:

1. general.ddl: General SQL-92 (or whatever version you prefer) syntax
2. oracle.ddl:  Oracle specific syntax for production
3. hsqldb.ddl:  HSQLDB syntax for unit tests (same as 2, but slightly
different syntax)

With some tweaking to 1 there were actually very few thing that needed
to go into 2 and 3. Just a couple of sequences IIRC.

So for production we create the database using scripts 1 and 2, and for
tests we use scripts 1 and 3.

Haikal Saadh wrote:
> Yeah, that's how I started out initially, but unfortunately, this app's a
> wrapper for an Oracle database, and thus, needs oracle specific SQL.
> 
> 
> Dennis Lundberg-2 wrote:
>> A totally different way to do it is to run your DAO test cases against
>> an embedded database like HSQLDB or perhaps Derby. We use HSQLDB for
>> this with at file based database that gets created locally when the
>> tests are run.
>>
>> I know this doesn't answer your question, I'm just thinking outside the
>> box here :-)
>>
>> Haikal Saadh wrote:
>>> Hi all.
>>>
>>> I'm trying to figure out what the best way is to exclude DAO tests. The
>>> reason for this being that not everyone who checks a project out may have
>>> the credentials necessary to connect to the database.
>>>
>>> At the moment, I have two profiles like this:
>>>
>>> <profiles>
>>>     <profile>
>>>       <id>skip-dao-tests</id>
>>>       <activation>
>>>         <activeByDefault>true</activeByDefault>
>>>       </activation>
>>>       <build>
>>>         <plugins>
>>>           <plugin>
>>>             <groupId>org.apache.maven.plugins</groupId>
>>>             <artifactId>maven-surefire-plugin</artifactId>
>>>             <configuration>
>>>               <excludes>
>>>                 <exclude>**/WhatEverDaoTest.java</exclude>
>>>               </excludes>
>>>             </configuration>
>>>           </plugin>
>>>         </plugins>
>>>       </build>
>>>     </profile>
>>>     <profile>
>>>       <id>run-dao-tests</id>
>>>       <activation>
>>>         <property>
>>>           <name>run.dao.tests</name>
>>>           <value>true</value>
>>>         </property>
>>>       </activation>
>>>       <build>
>>>         <plugins>
>>>           <plugin>
>>>             <groupId>org.apache.maven.plugins</groupId>
>>>             <artifactId>maven-surefire-plugin</artifactId>
>>>           </plugin>
>>>         </plugins>
>>>       </build>
>>>       <dependencies>
>>>         ...
>>>       </dependencies>
>>>     </profile>
>>> </profiles>
>>>
>>> This works fine, but it just seems like it's bloating the pom.
>>>
>>> I could move the DAO tests to a new module, but then, I'd have two
>>> different
>>> sets of cobertura/surefire reports for the same thing.
>>>
>>> Any different approaches I can try? Or is this pretty much it?
>>>
>>> Thanks.
>>
>> -- 
>> Dennis Lundberg
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Rusty Wright <ru...@gmail.com>.
Hey, for once I figured something out on my own.  I need to exclude a test on Windows; it's testing sending email using localhost and my desktop pc isn't running an smtp server. In my pom.xml I have

    <profiles>
        <profile>
            <id>windows</id>

            <activation>
                <os>
                    <family>Windows</family>
                </os>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>

                        <configuration>
                            <excludedGroups>unix-only</excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

And the test method starts like this:

    @Test(groups = {
        "unix-only"
    })
    public void sendLocalTest() {
        final Email myEmail = new Email("localhost", "root", null, "rusty@whatever");

        log.debug("sending using localhost");


Olivier THIERRY wrote:
> I can't see if you use TestNG or JUnit to write your tests, but if you use
> TestNG you can use its groups feature.
> You can put your dao tests in a dedicated group and exclude this group when
> running tests.
> This link should help you :
> http://testng.org/doc/documentation-main.html#test-groups
> 
> 2008/9/15 Haikal Saadh <sp...@gmail.com>
> 
>> Yeah, that's how I started out initially, but unfortunately, this app's a
>> wrapper for an Oracle database, and thus, needs oracle specific SQL.
>>
>>
>> Dennis Lundberg-2 wrote:
>>> A totally different way to do it is to run your DAO test cases against
>>> an embedded database like HSQLDB or perhaps Derby. We use HSQLDB for
>>> this with at file based database that gets created locally when the
>>> tests are run.
>>>
>>> I know this doesn't answer your question, I'm just thinking outside the
>>> box here :-)
>>>
>>> Haikal Saadh wrote:
>>>> Hi all.
>>>>
>>>> I'm trying to figure out what the best way is to exclude DAO tests. The
>>>> reason for this being that not everyone who checks a project out may
>> have
>>>> the credentials necessary to connect to the database.
>>>>
>>>> At the moment, I have two profiles like this:
>>>>
>>>> <profiles>
>>>>     <profile>
>>>>       <id>skip-dao-tests</id>
>>>>       <activation>
>>>>         <activeByDefault>true</activeByDefault>
>>>>       </activation>
>>>>       <build>
>>>>         <plugins>
>>>>           <plugin>
>>>>             <groupId>org.apache.maven.plugins</groupId>
>>>>             <artifactId>maven-surefire-plugin</artifactId>
>>>>             <configuration>
>>>>               <excludes>
>>>>                 <exclude>**/WhatEverDaoTest.java</exclude>
>>>>               </excludes>
>>>>             </configuration>
>>>>           </plugin>
>>>>         </plugins>
>>>>       </build>
>>>>     </profile>
>>>>     <profile>
>>>>       <id>run-dao-tests</id>
>>>>       <activation>
>>>>         <property>
>>>>           <name>run.dao.tests</name>
>>>>           <value>true</value>
>>>>         </property>
>>>>       </activation>
>>>>       <build>
>>>>         <plugins>
>>>>           <plugin>
>>>>             <groupId>org.apache.maven.plugins</groupId>
>>>>             <artifactId>maven-surefire-plugin</artifactId>
>>>>           </plugin>
>>>>         </plugins>
>>>>       </build>
>>>>       <dependencies>
>>>>         ...
>>>>       </dependencies>
>>>>     </profile>
>>>> </profiles>
>>>>
>>>> This works fine, but it just seems like it's bloating the pom.
>>>>
>>>> I could move the DAO tests to a new module, but then, I'd have two
>>>> different
>>>> sets of cobertura/surefire reports for the same thing.
>>>>
>>>> Any different approaches I can try? Or is this pretty much it?
>>>>
>>>> Thanks.
>>>
>>> --
>>> Dennis Lundberg
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>> --
>> View this message in context:
>> http://www.nabble.com/Neater-way-to-include-exclude-DAO-tests--tp19485851p19489322.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Olivier THIERRY <ol...@gmail.com>.
I can't see if you use TestNG or JUnit to write your tests, but if you use
TestNG you can use its groups feature.
You can put your dao tests in a dedicated group and exclude this group when
running tests.
This link should help you :
http://testng.org/doc/documentation-main.html#test-groups

2008/9/15 Haikal Saadh <sp...@gmail.com>

>
> Yeah, that's how I started out initially, but unfortunately, this app's a
> wrapper for an Oracle database, and thus, needs oracle specific SQL.
>
>
> Dennis Lundberg-2 wrote:
> >
> > A totally different way to do it is to run your DAO test cases against
> > an embedded database like HSQLDB or perhaps Derby. We use HSQLDB for
> > this with at file based database that gets created locally when the
> > tests are run.
> >
> > I know this doesn't answer your question, I'm just thinking outside the
> > box here :-)
> >
> > Haikal Saadh wrote:
> >> Hi all.
> >>
> >> I'm trying to figure out what the best way is to exclude DAO tests. The
> >> reason for this being that not everyone who checks a project out may
> have
> >> the credentials necessary to connect to the database.
> >>
> >> At the moment, I have two profiles like this:
> >>
> >> <profiles>
> >>     <profile>
> >>       <id>skip-dao-tests</id>
> >>       <activation>
> >>         <activeByDefault>true</activeByDefault>
> >>       </activation>
> >>       <build>
> >>         <plugins>
> >>           <plugin>
> >>             <groupId>org.apache.maven.plugins</groupId>
> >>             <artifactId>maven-surefire-plugin</artifactId>
> >>             <configuration>
> >>               <excludes>
> >>                 <exclude>**/WhatEverDaoTest.java</exclude>
> >>               </excludes>
> >>             </configuration>
> >>           </plugin>
> >>         </plugins>
> >>       </build>
> >>     </profile>
> >>     <profile>
> >>       <id>run-dao-tests</id>
> >>       <activation>
> >>         <property>
> >>           <name>run.dao.tests</name>
> >>           <value>true</value>
> >>         </property>
> >>       </activation>
> >>       <build>
> >>         <plugins>
> >>           <plugin>
> >>             <groupId>org.apache.maven.plugins</groupId>
> >>             <artifactId>maven-surefire-plugin</artifactId>
> >>           </plugin>
> >>         </plugins>
> >>       </build>
> >>       <dependencies>
> >>         ...
> >>       </dependencies>
> >>     </profile>
> >> </profiles>
> >>
> >> This works fine, but it just seems like it's bloating the pom.
> >>
> >> I could move the DAO tests to a new module, but then, I'd have two
> >> different
> >> sets of cobertura/surefire reports for the same thing.
> >>
> >> Any different approaches I can try? Or is this pretty much it?
> >>
> >> Thanks.
> >
> >
> > --
> > Dennis Lundberg
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Neater-way-to-include-exclude-DAO-tests--tp19485851p19489322.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et encore
pour l'univers, je ne suis pas sûr … (Einstein)

Re: Neater way to include/exclude DAO tests?

Posted by Haikal Saadh <sp...@gmail.com>.
Yeah, that's how I started out initially, but unfortunately, this app's a
wrapper for an Oracle database, and thus, needs oracle specific SQL.


Dennis Lundberg-2 wrote:
> 
> A totally different way to do it is to run your DAO test cases against
> an embedded database like HSQLDB or perhaps Derby. We use HSQLDB for
> this with at file based database that gets created locally when the
> tests are run.
> 
> I know this doesn't answer your question, I'm just thinking outside the
> box here :-)
> 
> Haikal Saadh wrote:
>> Hi all.
>> 
>> I'm trying to figure out what the best way is to exclude DAO tests. The
>> reason for this being that not everyone who checks a project out may have
>> the credentials necessary to connect to the database.
>> 
>> At the moment, I have two profiles like this:
>> 
>> <profiles>
>>     <profile>
>>       <id>skip-dao-tests</id>
>>       <activation>
>>         <activeByDefault>true</activeByDefault>
>>       </activation>
>>       <build>
>>         <plugins>
>>           <plugin>
>>             <groupId>org.apache.maven.plugins</groupId>
>>             <artifactId>maven-surefire-plugin</artifactId>
>>             <configuration>
>>               <excludes>
>>                 <exclude>**/WhatEverDaoTest.java</exclude>
>>               </excludes>
>>             </configuration>
>>           </plugin>
>>         </plugins>
>>       </build>
>>     </profile>
>>     <profile>
>>       <id>run-dao-tests</id>
>>       <activation>
>>         <property>
>>           <name>run.dao.tests</name>
>>           <value>true</value>
>>         </property>
>>       </activation>
>>       <build>
>>         <plugins>
>>           <plugin>
>>             <groupId>org.apache.maven.plugins</groupId>
>>             <artifactId>maven-surefire-plugin</artifactId>
>>           </plugin>
>>         </plugins>
>>       </build>
>>       <dependencies>
>>         ...
>>       </dependencies>
>>     </profile>
>> </profiles>
>> 
>> This works fine, but it just seems like it's bloating the pom.
>> 
>> I could move the DAO tests to a new module, but then, I'd have two
>> different
>> sets of cobertura/surefire reports for the same thing.
>> 
>> Any different approaches I can try? Or is this pretty much it?
>> 
>> Thanks.
> 
> 
> -- 
> Dennis Lundberg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Neater-way-to-include-exclude-DAO-tests--tp19485851p19489322.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Neater way to include/exclude DAO tests?

Posted by Dennis Lundberg <de...@apache.org>.
A totally different way to do it is to run your DAO test cases against
an embedded database like HSQLDB or perhaps Derby. We use HSQLDB for
this with at file based database that gets created locally when the
tests are run.

I know this doesn't answer your question, I'm just thinking outside the
box here :-)

Haikal Saadh wrote:
> Hi all.
> 
> I'm trying to figure out what the best way is to exclude DAO tests. The
> reason for this being that not everyone who checks a project out may have
> the credentials necessary to connect to the database.
> 
> At the moment, I have two profiles like this:
> 
> <profiles>
>     <profile>
>       <id>skip-dao-tests</id>
>       <activation>
>         <activeByDefault>true</activeByDefault>
>       </activation>
>       <build>
>         <plugins>
>           <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-surefire-plugin</artifactId>
>             <configuration>
>               <excludes>
>                 <exclude>**/WhatEverDaoTest.java</exclude>
>               </excludes>
>             </configuration>
>           </plugin>
>         </plugins>
>       </build>
>     </profile>
>     <profile>
>       <id>run-dao-tests</id>
>       <activation>
>         <property>
>           <name>run.dao.tests</name>
>           <value>true</value>
>         </property>
>       </activation>
>       <build>
>         <plugins>
>           <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-surefire-plugin</artifactId>
>           </plugin>
>         </plugins>
>       </build>
>       <dependencies>
>         ...
>       </dependencies>
>     </profile>
> </profiles>
> 
> This works fine, but it just seems like it's bloating the pom.
> 
> I could move the DAO tests to a new module, but then, I'd have two different
> sets of cobertura/surefire reports for the same thing.
> 
> Any different approaches I can try? Or is this pretty much it?
> 
> Thanks.


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org