junit.framework.AssertionFailedError while testing back button on android

0
0

i am new to Robotium.I’m facing an issue “junit.framework.AssertionFailedError” while executing the test case which using Robotium.Test scenario is checking Back button functionality.here’s my code

    package com.example.test;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.EditText;
import com.jayway.android.robotium.solo.Solo;
import com.example.app.R;
import com.example.app.LoginActivity;
import com.example.app.AccountCardListActivity;
import com.example.app.ReceiptListActivity;
import com.example.app.WithdrawalListActivity;
public class Back_Concerto_425 extends ActivityInstrumentationTestCase2<LoginActivity>{
public Back_Concerto_425() {
super(LoginActivity.class);
// TODO Auto-generated constructor stub
}
private Solo solo;
protected void setUp() throws Exception
{
solo
= new Solo(getInstrumentation(), getActivity());
}
public void testbackbutton()
{
solo
.enterText(0, "username");
solo
.enterText(1, "password");
solo
.clickOnButton(0);
solo
.waitForActivity("com.example.app.WithdrawalListActivity", 3000);
assertTrue
(solo.searchText("WithdrawlListActivity"));
solo
.clickOnButton("View Receipts");
solo
.waitForActivity("com.example.app.ReceiptListActivity",3000);
assertTrue
(solo.searchText("Receipts"));
solo
.goBackToActivity("com.example.app.WithdrawalListActivity");
assertTrue
(solo.searchButton("View Receipts"));
assertTrue
(solo.searchButton("New withdrawal"));
}
public void tearDown() throws Exception
{
try
{
solo
.finalize();
}
catch (Throwable e)
{
e
.printStackTrace();
}
super.tearDown();
}
}

Here’s My error log

[INFO]     Start [15/16]: com.ncr.mobile.mcw.test.WithdrawlListActivityTest#testreceiptsbutton
[INFO] FAILURE:com.ncr.mobile.mcw.test.WithdrawlListActivityTest#testreceiptsbutton
[INFO] junit.framework.AssertionFailedError
at com
.ncr.mobile.mcw.test.WithdrawlListActivityTest.testreceiptsbutton(WithdrawlListActivityTest.java:45)
at java
.lang.reflect.Method.invokeNative(Native Method)
at android
.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android
.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android
.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
at android
.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android
.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android
.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android
.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)

Please let me know if there is any mistake in my code.

  • You must to post comments
0
0

once one of my friend faced the same problem he resolved by giving timeout period,similarly you haven’t mentioned timeout period in waitactivity method or by just using WaitActivity method without timeout argument.

Hope it helps

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website