Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to Calabash and I am looking for a solution... The test case says: I have to verify the text on txt_email Below are the properties of txt_email and I have to verify that the txt_email value is

                       "id" => "txt_email",
                  "enabled" => true,
       "contentDescription" => nil,
                    "class" => "android.widget.EditText",
                    "text"  => "",
                     "rect" => {
           "center_y" => 342.5,
           "center_x" => 1059.0,
             "height" => 72,
                  "y" => 378,
              "width" => 168,
                  "x" => 975
              "description" => "android.widget.EditText{......}"

I have used a custom step :

When /^I am verify for editText of email$/ do
  performAction('assert_view_property', "txt_email", "text", "")

but its not working...

Thanks, Cuong Nguyen

share|improve this question
up vote 3 down vote accepted

The possible solution is below.

Then /^I verify text in email field$/ do
  expected_text = ""
  actual_text = query("EditText id:'txt_email'", :text).first
  unless expected_text == actual_text
    fail "Text in email field is incorrect. Expected '#{expected_text}', but got '#{actual_text}'."

It can be parametrized as well, for instance:

Then /^email should be ".*"$/ do |expected_email|
  actual_email = query("EditText id:'txt_email'", :text).first
  unless expected_email == actual_email
    fail "Text in email field is incorrect. Expected '#{expected_text}', but got '#{actual_text}'."
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.