Skip to content

TESP.01-Exercise-FinishOrderActivityBasicTest - Bad logic in test #25

@guillermo-ampie

Description

@guillermo-ampie

In the method clickDecrementButton_ChangesQuantityAndCost() we should increment first the quantity to "1" to test that the decrement button works!. Comments updated accordingly:

    @Test
    public void clickDecrementButton_ChangesQuantityAndCost() {

    // Check the initial quantity variable is zero
    onView((withId(R.id.quantity_text_view))).check(matches(withText("0")));

    // Click on increment button
    onView((withId(R.id.increment_button)))
        .perform(click());

    // Click on decrement button
    onView((withId(R.id.decrement_button)))
            .perform(click());

    // Verify that the decrement button decreases the quantity by 1
    onView(withId(R.id.quantity_text_view)).check(matches(withText("0")));

    // Verify that the decrement button also decreases the total cost from $5.00 to $0.00
    onView(withId(R.id.cost_text_view)).check(matches(withText("$0.00")));

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions