Skip to content

Instantly share code, notes, and snippets.

@fitomad
Last active December 15, 2015 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/49e72a6bdfd2988a6a72 to your computer and use it in GitHub Desktop.
Save fitomad/49e72a6bdfd2988a6a72 to your computer and use it in GitHub Desktop.
///
/// 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