Streaming Video from iOS Devices
Many testers may be unaware of a recent betterment to recording a video of the device blind on iOS device during a test run. The dictation have not changed: in order to begin record the screen, call thestartScreenRecordingcommand. There are multiple options available for specifying frame rate and such, and when you stop recording using the stopScreenRecording command, it will return the video file or upload the file to a url you provide. The surprising new functionality is that erst you & # x27; ve begin the recording, you can access a live cyclosis picture of the screen. All it takes is pointing your web browser to localhost:9100 and your browser will render this current. You could use a video-recording tool to disk from this flow if you desire. SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses. After this mjpeg stream functionality was liberate, Jonathan was doing some work about image-based testing of games and want a way to speed up Appium & # x27; s ability to take a screenshot. With image-based examination, Appium needs to occupy a screenshot every time it looks for an element. If taking a screenshot could be made faster, than the tests race up dramatically. The thought is, if you arealreadyrecording a video of your test run, taking a screenshot should be unneeded. Instead, Appium could use the latest soma of your video transcription. The way this was implemented was by adding a new desired potentiality called mjpegScreenshotUrl. Setting this desired capacity to the url of an mjpeg picture stream (provided by any means), Appium will follow the stream and return the late frame rather of adjudicate to catch a screenshot normally. On Android, this should provide a significant execution improvement, but setting up the mjpeg stream for an Android examination run is not so simple, and will be the topic of a future article. On iOS, we already get this mjpeg current furnish by nonpayment whenever we start screen recording! We can pass in localhost:9100 as the value for the mjpegScreenshotUrl trust capacity, and Appium will retrieve screenshots from the stream rather of lam a screenshot command on the device. This performance upgrade was designed for Android devices which sometimes return screenshots rattling slowly. iOS doesn & # x27; t have this problem and counterintuitively, this performance & quot; improvement & quot; actually get my test to run slower! Interesting to learn about, but I & # x27; d notify not apply mjpegScreenshotUrl on iOS. I expect outstanding improvements to Android screenshot times though, so look forward to that in an forthcoming post. Here is the code I utilize to test both methods of salve screenshots: The entire exam file can be constitute in ourexample code repository. Lead, Content Marketing, HeadSpin Inc. Piali is a dynamic and results-driven Content Marketing Specialist with 8+ years of experience in crafting engaging narratives and marketing collateral across diverse industries. She surpass in collaborating with cross-functional teams to evolve advanced content strategy and deliver compelling, authentic, and impactful content that resonates with target audiences and enhances brand authenticity. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts..png)



Streaming Video from iOS Devices
AI-Powered Key Takeaways

@ Test world void timeScreenshotsWithDefaultBehavior () throw IOException, URISyntaxException, InterruptedException, ExecutionException, TimeoutException {DesiredCapabilities crest = new DesiredCapabilities (); caps.setCapability (`` platformName '', `` iOS ''); caps.setCapability (`` platformVersion '', `` 12.4 ''); caps.setCapability (`` deviceName '', `` iPhone Xs ''); caps.setCapability (`` automationName '', `` XCUITest ''); caps.setCapability (`` app '', IOS_APP); driver = new IOSDriver (new URL (`` http: //0.0.0.0:4723/wd/hub ''), caps); driver.startRecordingScreen (); // this is unneeded for this examination run, but include hither to get this test identical to the next tryout long startTime = System.nanoTime (); for (int i = 0; i< 100; i++) {
driver.getScreenshotAs(OutputType.FILE);
}
long endTime = System.nanoTime();
long msElapsed = (endTime - startTime) / 1000000;
System.out.println("100 screenshots normally: " + msElapsed + "ms. On average " + msElapsed/100 + "ms per screenshot");
// about 172ms per screenshot on my machine
}
@Test
public void timeScreenshotsWithMjpegScreenshotBehavior() throws IOException, URISyntaxException, InterruptedException, ExecutionException, TimeoutException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platformName", "iOS");
caps.setCapability("platformVersion", "12.4");
caps.setCapability("deviceName", "iPhone Xs");
caps.setCapability("automationName", "XCUITest");
caps.setCapability("app", IOS_APP);
driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), caps);
driver.startRecordingScreen();
long startTime = System.nanoTime();
for (int i = 0; i < 100; i++) {
driver.getScreenshotAs(OutputType.FILE);
}
long endTime = System.nanoTime();
long msElapsed = (endTime - startTime) / 1000000;
System.out.println("100 screenshots using mjpeg: " + msElapsed + "ms. On average " + msElapsed/100 + "ms per screenshot");
// about 436ms per screenshot on my machine
}
Piali Mazumdar
Streaming Video from iOS Devices
4 Parts
-1280X720-Final-2.jpg)
Regression Intelligence pragmatic guide for advanced users (Part 3)
-1280X720-Final-2.jpg)
Regression Intelligence practical guide for advanced users (Part 4)
Discover how HeadSpin can empower your business with superior testing capabilities







Discover how HeadSpin can empower your business with superior testing capability
Discover how HeadSpin can endue your business with superior testing capabilities
Connet Now


Automate This With SUSA
Test Your App Autonomously







.png)












