Test Automation Mobile ToolBox

Who am I?

- Quality Assurance Engineer;
- Mobile Developer Wannabe (weekends only)
- Craft Beer Enthusiast (trying to be...);
- IoT Enthusiast;
- Junior Mechanic;
- Dicas do Dollynho fan;

So...And?

Unit

Unit

Use o que a apple fornece

Unit

XCTest

Unit

stub(isHost("api.myserver.com") && isPath("/resource")) { _ in
    guard let path = OHPathForFile("success_resource_response.json", self.dynamicType) else {
            preconditionFailure("Could not find expected file in test bundle")
    }

    return OHHTTPStubsResponse(
            fileAtPath: path,
            statusCode: 200,
            headers: [ "Content-Type": "application/json" ]
    )
}

Unit

Unit

Android Unit Testing

- JUnit 4,Hamcrest and luck
- Local Testing
- Instrumented Testing
- Mockito (ou unmock)

Unit

Android Unit Testing

import org.junit.Test;
import java.util.regex.Pattern;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class EmailValidatorTest {

    @Test
    public void emailValidator_CorrectEmailSimple_ReturnsTrue() {
        assertThat(EmailValidator.isValidEmail("name@email.com"), is(true));
    }
    ...
}

Unit

- Open source
- Run on JVM (like instrumented testing)


@RunWith(RobolectricTestRunner.class)
public class MyActivityTest {

  @Test
  public void clickingButton_shouldChangeResultsViewText() throws Exception {
    MyActivity activity = Robolectric.setupActivity(MyActivity.class);

    Button button = (Button) activity.findViewById(R.id.button);
    TextView results = (TextView) activity.findViewById(R.id.results);

    button.performClick();
    assertThat(results.getText().toString()).isEqualTo("Robolectric Rocks!");
  }
}

Unit

Integration

Integration

Integration

Integration

Integration

Integration

given().
        config(newConfig().jsonConfig(jsonConfig().numberReturnType(BIG_DECIMAL))).
when().
        get("/price").
then().
        body("price", is(new BigDecimal(12.12));

UI and Others

UI and Others

UI and Others

XCTest

  func testExample() {
       
        
        let app = XCUIApplication()
        let microphoneButton = app.buttons["microphone"]
        microphoneButton.tap()
        microphoneButton.tap()
        
        let microphoneElement = app.otherElements.containingType
                                (.Button, identifier:"microphone").element
        microphoneElement.tap()
        microphoneElement.tap()
    }

UI and Others

@Test
public void greeterSaysHello() {
  onView(withId(R.id.name_field))
    .perform(typeText("Steve"));
  onView(withId(R.id.greet_button))
    .perform(click());
  onView(withText("Hello Steve!"))
    .check(matches(isDisplayed()));
}

UI and Others

Cloud

Cloud

Reports

Allure

Reports

http://relevantcodes.com/Tools/ExtentReports2/ExtentJava.html

E-mail: rsaccoll@gmail.com
Twitter: @rsaccoll
AgileTesters: http://agiletesters.com.br/user/ramses-saccol-de-almeida

Mobile ToolBox

By Ramses Almeida

Mobile ToolBox

  • 63