On Tuesday, September 11, 2012 7:24:57 PM UTC-7, Arjun wrote:
>
> Yes, i used this code 
> package com.android.comera
>

Don't use 'com.android.*' for your own code unless you own the 
"android.com" domain.
 

> import com.jayway.android.robotium.solo.Solo;
>
> import android.test.ActivityInstrumentationTestCase2;
>
> @SuppressWarnings("unchecked")
> public class Mytest extends ActivityInstrumentationTestCase2 {
>

You omitted the generic parameter. Don't '@SuppressWarnings()' unless you 
do it correctly.


>         private static final String TARGET_PACKAGE_ID = 
> "com.android.comera";
>         private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = 
> "com.android.camera.DashboardListActivity";
>

Why do the Android and Java packages differ?
 

>         private static Class<?> launcherActivityClass;
>         static{
>                 try {
>                         launcherActivityClass = 
> Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
>

Why do you do this?
 

>                 } catch (ClassNotFoundException e) {
>                         throw new RuntimeException(e);
>                 }
>         }
>         
>         @SuppressWarnings("unchecked")
>

Not only should you not use this '@SuppressWarnings()', it's carelessly 
redundant from the class-level annotation.
 

>         public Mytest() throws ClassNotFoundException {
>                 super(TARGET_PACKAGE_ID, launcherActivityClass);
>

"*This constructor is deprecated. use 
ActivityInstrumentationTestCase2(Class)<http://developer.android.com/reference/android/test/ActivityInstrumentationTestCase2.html#ActivityInstrumentationTestCase2(java.lang.Class<T>)>
 instead*" [sic]
http://developer.android.com/reference/android/test/ActivityInstrumentationTestCase2.html#ActivityInstrumentationTestCase2(java.lang.String,
 
java.lang.Class<T>)
 

>         }
>         
>         private Solo solo;
>         
>         @Override
>         protected void setUp() throws Exception {
>                 solo = new Solo(getInstrumentation(), getActivity());
>         }
>
>         public void testCanOpenSettings(){
>                solo.sendKey(solo.ENTER)
>                 solo.pressMenuItem(0);
>
>                solo.clickonscreen(743,411)
>

This did not compile.
 

> ///For opening the image viewer in camera once the image i entered into 
> the image viewer
> I am "Views are showing 0" and also unable to perfom event 
> solo.clickonscreen(743,411) (click is not complete error is comming.
>

Where is the "Views are showing 0" message coming from? Did you read 
http://sscce.org/ ?
 

>         }
>
>
>  @Override
>    public void tearDown() throws Exception {
>                 solo.finishOpenedActivities();
>
>   }
>
>
> }
>
> Not finding the views in camera image viewer ArrayLiet <view> view 
> solo.getViews();
> i am not getting any views and any button information. If i used    
>  solo.clickonscreen(x,Y) Getting Error Like " click is incomplete.
>
> Application Source code is not available so i cannot use the resource id . 
> so what is solution for this . Is there any other solution?
>

The test you wrote is not just for a different Activity, it's for a 
different application than the camera app.

The code you show won't even compile, doesn't show the errors you claim to 
receive, and is therefore not 
extremely helpful.

But it looks like you're trying to use a 'Solo' instance bound to your app 
to control the screen when another app 
takes over. That doesn't work. I don't know the solution to that, but I 
believe you need a separate 
test app specific to the application you wish to test.

It's coordinating the two test apps that I don't know how to do. Yet.

-- 
Lew

 Lew wrote:

> Yes, but you still have to write source code to do so.
>
> Arjun wrote:
>
>> In robotium its possible to test the Preinstalled application  
>> http://code.google.com/p/**robotium/wiki/**RobotiumForPreInstalledApps<http://code.google.com/p/robotium/wiki/RobotiumForPreInstalledApps>
>>  
>>
>> On Tue, Sep 11, 2012 at 11:41 PM, Lew  wrote:
>>
>>> How do you write a test without source code?
>>>
>>> Arjun wrote:
>>>>
>>>> Thanks for your reply actually i [sic] am testing testing the APK 
>>>> without source code.
>>>>
>>>> Lew wrote:
>>>>
>>>> Arjun wrote:
>>>>>>
>>>>>> can you pla tel me the example how to use it in case if get 
>>>>>> ArrayList<view> view= solo.getviews(); is comming  0 i mean 
>>>>>> in this case what is the solution can u give me a example
>>>>>>
>>>>>> You should introduce new questions as new topics, but here goes. From 
>>>>> a code fragment it's 
>>>>> impossible to be certain. I've seen timing issues, where Views aren't 
>>>>> rendered yet at the time 
>>>>> 'solo' is looking. If you can peg a specific view, say by resource ID 
>>>>> ('R.id.foobar'), you can 
>>>>> wait for a view with something like 
>>>>>
>>>>>  boolean gotView = solo.waitForView(solo.getView(****R.id.foobar));
>>>>>
>>>>> 'getViews()' returns "an ArrayList of all the View objects located in 
>>>>> the focused Activity or Dialog."
>>>>>
>>>>> Perhaps your focused 'Activity' or 'Dialog' didn't have any 'View's.
>>>>>
>>>>> Show us a complete example that illustrates your issue.
>>>>>
>>>>> http://sscce.org/
>>>>>
>>>>
 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to