sangmingming / robotium

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

New problem with two test cases for robotium #67

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.

1.

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.

2.i add  mySolo.waitForActivity(LAUNCHER_ACTIVITY_FULL_CLASSNAME, 10000) before 
trying to use drag().        LAUNCHER_ACTIVITY_FULL_CLASSNAME 
=com.android.calculator2.Calculator.but it still run failly.

3.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 issue reported on code.google.com by guost...@gmail.com on 10 Feb 2011 at 1:35

GoogleCodeExporter commented 9 years ago
Please do the following:

1. Change to Robotium 2.1? 

2. You have to add a wait before doing a drag. Try waitForText("any text on the 
screen", "10 000");

Original comment by renasr...@gmail.com on 10 Feb 2011 at 6:45

GoogleCodeExporter commented 9 years ago
Also please paste the log:

logcat.

Original comment by renasr...@gmail.com on 10 Feb 2011 at 6:58

GoogleCodeExporter commented 9 years ago
thank you for your reply so much.I also follow your method to solve this 
problem,but finally it still fail.now i put the code and logcat to you ,and 
look forward to your reply again,and i will appreciate you very much.

I did as follow:
1.Change to Robotium 2.1

2. add a wait before doing a drag. Try  
mySolo.waitForActivity(LAUNCHER_ACTIVITY_FULL_CLASSNAME, 10000);

thank you.................

Original comment by guost...@gmail.com on 15 Feb 2011 at 4:48

Attachments:

GoogleCodeExporter commented 9 years ago
I am sorry but I do not know how to help you. This has nothing to do with 
Robotium. It is an application problem. The only interesting I could see in the 
log was:

junit.framework.AssertionFailedError: Button with the text: sin is not found!

Otherwise I can not see anything interesting in the log and definitely not 
something that shows Robotium crashing etc. 

Please read this page:

http://code.google.com/p/robotium/wiki/Getting_Started

Original comment by renasr...@gmail.com on 15 Feb 2011 at 5:54

GoogleCodeExporter commented 9 years ago
i will also thank you so much.I ever see issue 30 in this,the probrem he meet 
with is the same,and he said he solved this problem,but when i turn to ask for 
help,he never answer me,now i will excepte for his answer to solve this problem.

thank your reply again,if you have spare time,could you hava a look at issue 
30... 

Original comment by guost...@gmail.com on 16 Feb 2011 at 11:53

GoogleCodeExporter commented 9 years ago
 Issue 30:  Problem with two test cases 

Original comment by guost...@gmail.com on 16 Feb 2011 at 11:59

GoogleCodeExporter commented 9 years ago
Yes it seems as if he fixed the problem. Try to email him instead. I hope you 
will find a solution.

Original comment by renasr...@gmail.com on 16 Feb 2011 at 12:02

GoogleCodeExporter commented 9 years ago
Dont forget to use tearDown(), look at the example test project.

Original comment by renasr...@gmail.com on 16 Feb 2011 at 12:12

GoogleCodeExporter commented 9 years ago
thank you ,i used tearDown().
i ever email the issue 30,but he always don't reply me,now i hope he can reply 
me as soon as possible.
thank you !

Original comment by guost...@gmail.com on 18 Feb 2011 at 1:48