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, "[EMAIL
PROTECTED]");
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 <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]