robolectric and powermock

359 views
Skip to first unread message

edwin

unread,
Dec 15, 2010, 9:05:09 AM12/15/10
to PowerMock
Hi,
Powermock uses the annotation @RunWith(PowerMockRunner.class).
Robolectric (http://pivotal.github.com/robolectric/index.html) also
uses the annotation @RunWith(RobolectricTestRunner.class)
Powermock and Robolectric share same @RunWith-annotation; that makes
that i can not use them together. Is there a way to develop a test
that uses both Powermock- and Robolectric-functionality?

Johan Haleby

unread,
Dec 15, 2010, 9:22:36 AM12/15/10
to powe...@googlegroups.com
Hi, 

Theoretically you can make use of the PowerMockRule but it's still experimental and doesn't work in all cases. The problem is our deep-cloner which can crash the JVM. We have plans to implement the deep-cloning mechanism using e.g. XML or JSON serialization instead. But you can give it a try and see if it works for you.

/Johan


--
You received this message because you are subscribed to the Google Groups "PowerMock" group.
To post to this group, send email to powe...@googlegroups.com.
To unsubscribe from this group, send email to powermock+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/powermock?hl=en.


Johan Haleby

unread,
Dec 28, 2010, 11:20:37 AM12/28/10
to PowerMock
As of PowerMock 1.4.7 you can try the new PowerMockRule with X-Stream
deep-cloning and see if it works for you.

/Johan

On Dec 15, 3:22 pm, Johan Haleby <johan.hal...@gmail.com> wrote:
> Hi,
>
> Theoretically you can make use of the
> PowerMockRule<http://code.google.com/p/powermock/wiki/PowerMockRule>
> but
> it's still experimental and doesn't work in all cases. The problem is our
> deep-cloner<http://blog.jayway.com/2009/12/23/classloader-deep-cloning-without-se...>which
> can crash the JVM. We have plans to implement the deep-cloning
> mechanism using e.g. XML or JSON serialization instead. But you can give it
> a try and see if it works for you.
>
> /Johan
>
>
>
>
>
>
>
> On Wed, Dec 15, 2010 at 3:05 PM, edwin <emu...@hotmail.com> wrote:
> > Hi,
> > Powermock uses the annotation @RunWith(PowerMockRunner.class).
> > Robolectric (http://pivotal.github.com/robolectric/index.html) also
> > uses the annotation @RunWith(RobolectricTestRunner.class)
> > Powermock and Robolectric share same @RunWith-annotation; that makes
> > that i can not use them together. Is there a way to develop a test
> > that uses both Powermock- and Robolectric-functionality?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "PowerMock" group.
> > To post to this group, send email to powe...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > powermock+...@googlegroups.com<powermock%2Bunsubscribe@googlegroups .com>
> > .
Reply all
Reply to author
Forward
0 new messages