Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Setup for non-maven
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Thomas H  
View profile  
 More options Nov 4 2012, 3:26 pm
From: Thomas H <thomas.heilbron...@googlemail.com>
Date: Sun, 4 Nov 2012 12:26:45 -0800 (PST)
Local: Sun, Nov 4 2012 3:26 pm
Subject: Re: [robolectric] Re: Setup for non-maven

For me the cause of the problem is the new junit 4.11-beta-1. It seems they
changed how Testrunners are invoked but I did not spot a related item in
the junit change log [1]
On my machine this can be reproduced with the RobolectricSample [2].
Just update the junit dependency in the pom to 4.11-beta-1 and run mvn
clean verify.
-> ClassCastExceptions in target/surefire-reports/*
If I switch back to junit 4.10 or junit-dep 4.10 everything works fine.

[1] https://github.com/KentBeck/junit/blob/master/doc/ReleaseNotes4.11.md
[2] https://github.com/pivotal/RobolectricSample

Am Dienstag, 30. Oktober 2012 21:55:01 UTC+1 schrieb Thomas H:

> I just saw that this thread is about non-maven projects. I am actually
> using maven.
> Does this exception make more sense in a maven context? Perhaps some
> configuration error in the pom?
> I will put together a minimal example to reproduce this problem and post
> it here later this week.

> On Monday, October 29, 2012 2:54:55 PM UTC+1, Phil Goodwin wrote:

>> I'll bet it's a classloader problem. The RobolectricTestRunner uses a
>> special classloader to instrument all of the Android jars and then loads
>> all of the tests along with a copy of itself in that classloader. After
>> that it delegates all of the calls made to itself to its copy within the
>> classloader via the RobolectricTestRunnerInterface. It appears that
>> something has gone wrong with that mechanism. Is there more than one copy
>> of Robolectric floating around by any chance?

>> On Sun, Oct 28, 2012 at 9:56 AM, Thomas H <thomas.he...@googlemail.com>wrote:

>>> Did you find a solution for this?
>>> I have the same problem:

>>> java.lang.ClassCastException:
>>> com.xtremelabs.robolectric.RobolectricTestRunner cannot be cast to
>>> com.xtremelabs.robolectric.internal.RobolectricTestRunnerInterface

>>> Am Samstag, 16. Juni 2012 00:50:15 UTC+2 schrieb Leif Ashley:

>>>> I just found the same line, and it is 234. Below is my whole class,
>>>> with some lines removed to protect the innocent. But we never get to the
>>>> setup method anyway because the constructor fails to complete. I agree
>>>> though, the class and structure looks fine, and I'm not sure why this would
>>>> throw the cast exception.

>>>> @RunWith(**RobolectricTestRunner.class)
>>>> public class Test1 {

>>>>     @Before
>>>>     public void setUp() throws Exception {
>>>>        ...
>>>>     }

>>>>     @Test
>>>>     public void test() throws Exception {
>>>>        ...
>>>>     }
>>>> }

>>>> On Friday, June 15, 2012 6:44:38 PM UTC-4, Chuck Greb wrote:

>>>>> I have never seen this error before. It looks like it's coming from
>>>>> this line but I'm not sure why. Are you using a custom test runner or class
>>>>> loader?

>>>>> https://github.com/pivotal/**robolectric/blob/master/src/**
>>>>> main/java/com/xtremelabs/**robolectric/**RobolectricTestRunner.java#**
>>>>> L234<https://github.com/pivotal/robolectric/blob/master/src/main/java/com/...>

>>>>> On Friday, June 15, 2012 6:28:31 PM UTC-4, Leif Ashley wrote:

>>>>>> Thanks again... that gets me further along, but now I get:

>>>>>> java.lang.RuntimeException: java.lang.ClassCastException:
>>>>>> com.xtremelabs.robolectric.**RobolectricTestRunner cannot be cast to
>>>>>> com.xtremelabs.robolectric.**internal.**
>>>>>> RobolectricTestRunnerInterface

>>>>>> It looks like the RobolectricTestRunner didn't implement the **RobolectricTestRunnerInterface
>>>>>> in this jar. Sound right to you?

>>>>>> On Friday, June 15, 2012 6:24:21 PM UTC-4, Chuck Greb wrote:

>>>>>>> Highlight robolectric-1.2-**SNAPSHOT-jar-with-**dependencies.jar
>>>>>>> and then from the bottom-right panel choose the "Artifact Information" tab
>>>>>>> and then you will see a button to Download.

>>>>>>> On Friday, June 15, 2012 6:19:32 PM UTC-4, Leif Ashley wrote:

>>>>>>>> Cool - I'll look at the starter. I have it somewhat running with a
>>>>>>>> quick test setup of my own, but I think I'm missing dependencies. I found
>>>>>>>> this on their site:

>>>>>>>> "If you’re not using Maven to build your project, you’ll probably
>>>>>>>> want to grab the latest robolectric-X.X.X-jar-with-**dependencies.jar
>>>>>>>> from Sonatype<https://oss.sonatype.org/index.html#nexus-search;quick~robolectric>
>>>>>>>> "

>>>>>>>> But for the life of me, I cannot figure out how to download the jar
>>>>>>>> from Sonatype. lol

>>>>>>>> On Friday, June 15, 2012 6:13:12 PM UTC-4, Chuck Greb wrote:

>>>>>>>>> Using IntelliJ, you can either include Robolectric as a module
>>>>>>>>> (source) or a library (jar). Robolectric should be added as a dependency to
>>>>>>>>> your application module (above Android platform, scope TEST).

>>>>>>>>> You should setup the tests as Java/JUnit (not an Android project
>>>>>>>>> test). Robolectric tests live inside the same module as your application.
>>>>>>>>> No emulator/device is required.

>>>>>>>>> Also, check out the AndroidIntelliJStarter project for a good
>>>>>>>>> example of integration as a submodule.

>>>>>>>>> https://github.com/pivotal/**AndroidIntelliJStarter<https://github.com/pivotal/AndroidIntelliJStarter>

>>>>>>>>> Best,
>>>>>>>>> Chuck

>>>>>>>>> On Friday, June 15, 2012 5:50:56 PM UTC-4, Leif Ashley wrote:

>>>>>>>>>> I am wanting to use Robolectric in our development efforts and
>>>>>>>>>> I'm a bit confused on a few points.

>>>>>>>>>> The examples all show maven. However we are using Idea to
>>>>>>>>>> run/test via the IDE launch and scripted ant scripts for test builds.
>>>>>>>>>> What's the best method to unit test an android application with Robolectric
>>>>>>>>>> in this senario? Do I create a separate java project or an Android test
>>>>>>>>>> project? Personally, I want to have it just run as a local test (i.e. not
>>>>>>>>>> running on a USB/simulator device).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.