JGeovani / robotium

Automatically exported from code.google.com/p/robotium
1 stars 0 forks source link

Problem with two test cases for robotium #59

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
When we run two test methods inside the class first one is working fine but 
second one is failing with some errors. If you run these two methods separately 
working fine without having any problems.
What is the expected output? What do you see instead?
both methods has to work without having any problems

What version of the product are you using? On what operating system?
robotium 2.0 and XP

Please provide any additional information below.
when run the second testcase,it would goback automaticly but also some sentence 
did not run. for example in calculator:

public void test0() throws Exception
    {
        mySolo.drag(238, 4, 206, 206, 10);
        mySolo.clickOnButton("cos");
        mySolo.clickOnButton(11);
    }
  @Smoke
    public void test1() throws Exception
    {
        mySolo.drag(238, 4, 206, 206, 10);
        mySolo.clickOnButton("cos");
        mySolo.clickOnButton(11);
     }
test1 could not run successfully,when run mySolo.drag(238, 4, 206, 206, 10);it 
would automatic quit.

Original issue reported on code.google.com by guost...@gmail.com on 25 Jan 2011 at 2:48

GoogleCodeExporter commented 9 years ago
my email :guost295@gmail.com.

Original comment by guost...@gmail.com on 25 Jan 2011 at 2:49

GoogleCodeExporter commented 9 years ago
Hi, You should add a waitForX() before the drag to make sure that the activity 
is loaded before trying to use drag(). If that does not work then please paste 
the log.

Original comment by renasr...@gmail.com on 25 Jan 2011 at 5:58

GoogleCodeExporter commented 9 years ago
thank you for your answer.
but the problem is still exist.i add  
mySolo.waitForActivity(LAUNCHER_ACTIVITY_FULL_CLASSNAME, 10000) before trying 
to use drag().        LAUNCHER_ACTIVITY_FULL_CLASSNAME 
=com.android.calculator2.Calculator.
the log is :
 junit.framework.AssertionFailedError: There is no Button with index 11
at com.jayway.android.robotium.solo.Clicker.clickOn(Clicker.java:333)
at com.jayway.android.robotium.solo.Solo.clickOnButton(Solo.java:908)
at 
com.android.newoppocalculator.newoppocalculator.test1(newoppocalculator.java:65)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(SourceFile:235)
at android.test.InstrumentationTestCase.runTest(SourceFile:225)
at 
android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTes
tCase2.java:217)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:200)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:185)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
1)
at android.app.Instrumentation$InstrumentationThread.run(SourceFile:1482)

Original comment by guost...@gmail.com on 25 Jan 2011 at 7:33

GoogleCodeExporter commented 9 years ago
i add  mySolo.waitForActivity(LAUNCHER_ACTIVITY_FULL_CLASSNAME, 10000)  in 
test0 and test1 before trying to use drag(),it says :There is no Button with 
index 11,because when it run the mySolo.clickOnButton("cos"),then it quit 
automaticly.

thank you again.

Original comment by guost...@gmail.com on 25 Jan 2011 at 7:37

GoogleCodeExporter commented 9 years ago
Thank you for your reply.
  but the problem is still exist.i add
mySolo.waitForActivity(LAUNCHER_ACTIVITY_FULL_CLASSNAME, 10000) before
trying to use drag().        LAUNCHER_ACTIVITY_FULL_CLASSNAME
=com.android.calculator2.Calculator.
the log is :
 junit.framework.AssertionFailedError: There is no Button with index 11
at com.jayway.android.robotium.solo.Clicker.clickOn(Clicker.java:333)
at com.jayway.android.robotium.solo.Solo.clickOnButton(Solo.java:908)
at
com.android.newoppocalculator.newoppocalculator.test1(newoppocalculator.java:65)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(SourceFile:235)
at android.test.InstrumentationTestCase.runTest(SourceFile:225)
at
android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTes
tCase2.java:217)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:200)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:185)
at
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
1)
at android.app.Instrumentation$InstrumentationThread.run(SourceFile:1482)

i add  mySolo.waitForActivity(LAUNCHER_ACTIVITY_FULL_CLASSNAME, 10000)  in
test0 and test1 before trying to use drag(),it says :There is no Button with
index 11,because when it run the mySolo.clickOnButton("cos"),then it quit
automaticly.
thank you again.

Original comment by guost...@gmail.com on 25 Jan 2011 at 11:37