maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baptiste MATHUS ...@batmat.net>
Subject Re: PowerMock tests work fine in Eclipse, but don't execute in Maven build
Date Mon, 21 Jan 2013 05:56:46 GMT
Hi,
If you could push your demo project somewhere like on github, maybe we can
help help you more easily.

Just a small guess: isn't powermock "full" some special jar embedding 3rd
Party code like testng and that would get selected?

Cheers
Le 21 janv. 2013 00:55, "KARR, DAVID" <dk068x@att.com> a écrit :

> I normally use Mockito and JUnit with Maven.  I'm trying to write some
> tests using PowerMock.  I got the PowerMock test working fine in Eclipse,
> but now I'm noticing that the test is not running in the Maven build.
>  Maven finds the test class, but it seems to think there are no tests.
>  It's also trying to run it with TestNG instead of JUnit, which is
> surprising.
>
> This is the build output I see:
> ----------------------
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running com.foo.tv.client.UiFeatureManagerTest
> Configuring TestNG with:
> org.apache.maven.surefire.testng.conf.TestNG652Configurator@76cbf7
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.69 sec
>
> Results :
>
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
> ---------------------------
>
> My very elided test class looks like this:
> ------------------------
> @RunWith(PowerMockRunner.class)
> @PrepareForTest({...})
> public class UiFeatureManagerTest {
>
>     private UiFeatureManager    uiFeatureManager;
>
> ...
>
>     @Before
>     public void setup() {
>         uiFeatureManager    = new UiFeatureManager(...);
>         ...
>         PowerMockito.mockStatic(Blio.class, OrderUtil.class);
>     }
>
>     @Test
>     public void lookupstuff() {
>         when(...).thenReturn(...);
>         ...
>     }
> -------------------
>
> This is my entire POM:
> -----------------------------
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>powermockdemo</groupId>
>     <artifactId>powermockdemo</artifactId>
>     <version>0.0.1-SNAPSHOT</version>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>2.3.2</version>
>                 <configuration>
>                     <source>1.6</source>
>                     <target>1.6</target>
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <version>2.12.4</version>
>                 <configuration>
>                     <failIfNoTests>true</failIfNoTests>
>                     <parallel>methods</parallel>
>                     <detail>true</detail>
>                     <additionalClasspathElements>
>
> <additionalClasspathElement>src/test/resources</additionalClasspathElement>
>
> <additionalClasspathElement>${project.build.directory}/classes</additionalClasspathElement>
>
> <additionalClasspathElement>${project.build.directory}/test-classes</additionalClasspathElement>
>                     </additionalClasspathElements>
>                     <argLine>${surefire.argLine}</argLine>
>
> <classesDirectory>${project.build.directory}/generated-classes/classes</classesDirectory>
>                     <forkMode>once</forkMode>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
>     <dependencies>
>         <dependency>
>             <groupId>commons-collections</groupId>
>             <artifactId>commons-collections</artifactId>
>             <version>3.2.1</version>
>         </dependency>
>         <dependency>
>             <groupId>commons-lang</groupId>
>             <artifactId>commons-lang</artifactId>
>             <version>2.6</version>
>         </dependency>
>         <dependency>
>             <groupId>org.powermock</groupId>
>             <artifactId>powermock-mockito-release-full</artifactId>
>             <version>1.5</version>
>             <classifier>full</classifier>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.easytesting</groupId>
>             <artifactId>fest-assert</artifactId>
>             <version>1.4</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>             <version>4.11</version>
>             <scope>test</scope>
>         </dependency>
>     </dependencies>
> </project>
> --------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message