Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9099105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:31:50+00:00 2026-06-17T00:31:50+00:00

I have written a GWTTestCase like this: public void testClickButton() { SampleView view =

  • 0

I have written a GWTTestCase like this:

public void testClickButton() {
    SampleView view = new SampleView();
    RootPanel.get().add(view);
    view.textBox.setText("Saeed Zarinfam");

    assertEquals("", view.label.getText());

//        ButtonElement.as(view.button.getElement()).click();
    view.button.getElement().<ButtonElement>cast().click();

    assertEquals("Bean \"OCTO\" has been created", view.label.getText());
}

When i run this test it connect to my servlet (i added some log on my servlet) but the RPC callback does not call in my SampleView, junit say:

expected: <Bean "OCTO" has been created>, actual: <>

This is my callback in button click handler:

@UiHandler("button")
void onClick(ClickEvent e) {

    labelTest.setText("click button");

    AsyncCallback<FooBean> callback = new AsyncCallback<FooBean>() {
        public void onFailure(Throwable caught) {
            // Show the RPC error message to the user
            labelTest.setText("call fail");
            label.setText("Failure : " + caught.getMessage());
        }

        public void onSuccess(FooBean result) {
            labelTest.setText("call success");
            label.setText("Bean \"" + result.getName() + "\" has been created");
        }
    };

    // Make the call. Control flow will continue immediately and later
    // 'callback' will be invoked when the RPC completes.
    service.createBean("OCTO", callback);


}

Why GWT rpc callback does not call in this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T00:31:51+00:00Added an answer on June 17, 2026 at 12:31 am

    RPC calls are asynchronous even in GWTTestCase. You have to call delayTestFinish() to tell the runner that the test is asynchronous, and call finish() “at some point in the future” to tell it it’s finished and OK (otherwise you’ll have a timeout).

    In your case, because the calling code has no way to know when the RPC call is finished, you can only do a wild guess at how many time it’ll take, and use Timer.
    Better refactor your code to make it more testable if you ask me (note: a Selenium would work roughly the same: check a condition every second until a timeout, http://seleniumhq.org/docs/02_selenium_ide.jsp#the-waitfor-commands-in-ajax-applications, just like a Timer that you’d re-schedule up to N times if the condition is not met)

    See https://developers.google.com/web-toolkit/doc/latest/DevGuideTesting#DevGuideAsynchronousTesting

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written: public string GetOutline(int indentLevel, XElement element) { StringBuilder result = new
I have written this piece of code: namespace { void SkipWhiteSpace(const char *&s) {
have written this little class, which generates a UUID every time an object of
I have written this code inside a servlet to delete certain records from three
I have written this code in JavaScript and works perfectly fine when I include
Have written the following code: m_selectCategoryTableWidget = new QTableWidget; m_selectCategoryTableWidget->setRowCount(0); m_selectCategoryTableWidget->setColumnCount(2); m_selectCategoryTableWidget->setHorizontalHeaderLabels(QStringList()<<tr(Category)<<tr(Number of items));
I have written a treetop grammer file that mostly works. For tags like [b]
Have written all the code in a silverlight class library (dll) and linked this
Have written a method; when I try to run it, I get the error:
I have written the following code as, Dim report As New ReportDocument report.PrintOptions.PrinterName =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.