Using the Appium Events API
Ever wondered what goes on under the punk while Appium is starting up, say, an iOS session using the XCUITest driver? Sometimes this is a process that takes several minutes, and sometimes it only takes a handful of moment. Having a look at the Appium logs can clear up this confusion (maybe you notice that the initiatory time you run an with a new edition of Appium, it spent clip rebuild WebDriverAgent -- that create signified). Just looking at the log doesn & # x27; t necessarily say you howlongAppium spent within each zone of its startup routine, though. You could become on timestamps in the logs (habituate-- log-timestamp), but so you have to do a bunch of mental gymnastics to develop a picture of the startup flow over time. For this reason, the Appium squad developed something called the & quot; Events API & quot; (or sometimes the & quot; Event Timings API & quot;). Basically, the timestamps of respective point of interest in the lifecycle of a session are logged automatically as & quot; case & quot;, which can be retrieved at any point during the test. Previously, it was possible to retrieve events use thegetSessionDetailscommand: For this to act, you also had to use theeventTimingscapability, and set it totrue, in order for Appium to decorate the session details response with the appropriate timing information. However, in the W3C protocol there is no road that correspond togetSessionDetails, and so the Appium team has added its own route, which is indorse in the Java client as thegetEvents command: Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script. What you get back from this vociferation is aServerEventsaim encapsulating the assorted types of datum returned with this API. Let & # x27; s take a look at the (truncated) raw API answer for an example call, so you can see its flesh: There are two independent sections here, one markcommands, and then a clustering of former names consisting of timestamps. All commands sent to the Appium server are considered events, and their start and end times are tracked. In addition, the hand-picked named case are include, for representativexcodeDetailsRetrievedor appConfiguredabove. (In all cases, the numeric values are timestamps in millisecond.) The ServerEventsobjective for this understanding has acommandsfield and aneventsbattlefield, each constituting a list of their own type (CommandEvent and ServerEvent) respectively, and check the case name and timestamp (s). In addition to the hand-picked events mechanically included by the Appium squad, you can also state the Appium server to include yourowncase within the event log, so that you can have a platter of when action within the domain of your trial logic occupy spot with respect to the built-in Appium dictation. To do this, you need to log the event: In the example above, we are logging an & # x27; eventName & # x27; event with the vendor gens & # x27; prefix & # x27;. Why do we need this vendor prefix? To ensure that custom-made events can never conflict with built-in ones, or with events lumber by another library. These custom case will show up when you phonegetEventsafterwards on! Here are some that I spark in a test of my covering: If you want, you can use the Java client to write out the raw data in JSON format somewhere on disk for use with other coating, too: With all of this raw information, you could build interesting visualizations of the clip Appium spent in between each of these events. But you don & # x27; t really need to, because the Appium squad already built a instrument to do this for you! It & # x27; s phone theEvent Parser, and it & # x27; s a CLI tool you install via NPM: You can use the Event Parser to give a timeline of all the case that are described in a JSON file, for example. (Did you notice the save command above? It become you exactly what you need to make this happen). (The -i flag is followed by the path to the data file, and -t tells the program you need a timeline printed out. You can also legislate an -l flag followed by a number to change the routine of line the timeline takes up). Once you run this command, you & # x27; ll be recognise by a nice slight timeline: You can also control out aentire sample testusing these features! Let me know if you come up with any interesting use cases for this API; I & # x27; m sure there & # x27; s some great hypothesis out there. Lead, Content Marketing, HeadSpin Inc. Piali is a dynamic and results-driven Content Marketing Specialist with 8+ age of experience in crafting engaging narratives and marketing collateral across diverse diligence. She excels in collaborating with cross-functional teams to develop innovative content strategies and deliver compelling, reliable, and impactful substance that resonates with target audience 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)



Using the Appium Events API
AI-Powered Key Takeaways

Check out:
Improve The Appium Testing Experience with HeadSpin.!
Getting case datum
Also check:
MapServerEvents events = driver.getEvents ();Read:
Understanding event information
{`` commands '': [{`` cmd '': `` findElement '', `` startTime '': 1573001594602, `` endTime '': 1573001594810}, {`` cmd '': `` getLogEvents '', `` startTime '': 1573001599636, `` endTime '': 1573001599636}], `` xcodeDetailsRetrieved '': [1573001580191], `` appConfigured '': [1573001586967], `` resetStarted '': [1573001586969]}Also read:
Custom events
CustomEvent evt = new CustomEvent (); evt.setVendorName (`` prefix ''); evt.setEventName (`` eventName ''); driver.logEvent (evt);... `` theapp: onLoginScreen '': [1573001595285], `` theapp: testEnd '': [1573001599630] ...Recommended post:
// assume we get ServerEvents object 'events' events.save (new File ('/path/to/events.json ') .toPath ());npm install -g appium-event-parserappium-event-parser -t -i /path/to/events.json
Piali Mazumdar
Using the Appium Events API
4 Parts
-1280X720-Final-2.jpg)
Regression Intelligence hardheaded guide for advanced users (Part 3)
-1280X720-Final-2.jpg)
Regression Intelligence practical guide for innovative users (Part 4)
Discover how HeadSpin can empower your business with superior essay capabilities







Discover how HeadSpin can empower your occupation with superior try potentiality
Discover how HeadSpin can empower your business with superior testing capability
Connet Now


Automate This With SUSA
Test Your App Autonomously







.png)












