- Quality Assurance Engineer;
- Mobile Developer Wannabe (weekends only)
- Craft Beer Enthusiast (trying to be...);
- IoT Enthusiast;
- Junior Mechanic;
- Dicas do Dollynho fan;
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" ]
)
}
- JUnit 4,Hamcrest and luck
- Local Testing
- Instrumented Testing
- Mockito (ou unmock)
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));
}
...
}
- 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!");
}
}
given().
config(newConfig().jsonConfig(jsonConfig().numberReturnType(BIG_DECIMAL))).
when().
get("/price").
then().
body("price", is(new BigDecimal(12.12));
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()
}
@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()));
}
http://relevantcodes.com/Tools/ExtentReports2/ExtentJava.html
E-mail: rsaccoll@gmail.com
Twitter: @rsaccoll
AgileTesters: http://agiletesters.com.br/user/ramses-saccol-de-almeida