/** * Verify how the API calls were made. * * @param TestEvent $event Event. * * @return void */ public function verifyRemoteAPICalls(TestEvent $event) { $test_case = $event->getTestCase(); if (get_class($test_case) !== get_class($this) || $test_case->getName() !== $this->getName()) { return; } $browser = $this->getBrowser(); if ($browser instanceof SauceLabsBrowserConfiguration) { $session = $event->getSession(); if ($session === null) { $this->markTestSkipped('Unable to connect to SauceLabs. Please check Internet connection.'); } $sauce_rest = new SauceRest($browser->getApiUsername(), $browser->getApiKey()); $job_info = $sauce_rest->getJob($session->getDriver()->getWebDriverSessionId()); $this->assertEquals(get_class($test_case) . '::' . $test_case->getName(), $job_info['name']); $passed_mapping = array('testSuccess' => true, 'testFailure' => false); $this->assertSame($passed_mapping[$test_case->getName()], $job_info['passed']); } }
/** * Update status of the test, that was executed in the given session. * * @param string $session_id Session ID. * @param boolean $test_status Test status. * * @return boolean */ public function updateStatus($session_id, $test_status) { return $this->_sauceRest->updateJob($session_id, array('passed' => $test_status)); }