Skip to content

Instantly share code, notes, and snippets.

@fitomad fitomad/measure-test.swift
Last active Dec 15, 2015

Embed
What would you like to do?
///
/// Prueba de rendimiento para la operacion
/// de recuperacion de datos para una serie de TV
///
func testShow()
{
// Manhattan Love Story
let showID: Int = 281624
// Closure de rendimiento
// Se ejecuta 10 veces
self.measureBlock()
{
let expectation: XCTestExpectation = self.expectationWithDescription("Rendimiento de fanartForShow()")
FanartClient.sharedInstance.fanartForShow(showID) { (show, error) -> (Void) in
// Comprobamos errores en la llamadas
XCTAssertNil(error, "Se ha producido un error en el framework")
if let show = show
{
print("# \(show.showName)")
}
else
{
print("#El show no existe")
}
// Operacion asincrona terminada
expectation.fulfill()
}
// Esperamos a que la operacion termine
self.waitForExpectationsWithTimeout(10, handler: { (error: NSError?) -> Void in
if let error = error
{
print("testError. \(error.localizedDescription)")
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.