All right. So I have Visual Studio code open here.
Again, you can use any IDE of your choice, but actually, before kind of navigating any IDE we, of course, need to have an Appium project. So traditionally you would kind of you would go the new project route and begin scripting out your Appium in itself can be kind of a lengthy, tedious thing to do, especially getting started. So once again this lesson will be making use of Kobiton Appium export.
So with that I'm going to navigate to Kobiton. So here in the Kobiton portal, we're going to go ahead and just launch any device. And let's say I have a specific test case. I want to automate the UI with. Automate it via Appium. So what I'll do is I'll go to install my application.
And as I make movements and installations on this real device, Nova Kobitons AI engine is capturing this entire manual session. So we installed this apk onto this android device.
And let's say I want to automate this kind of getting started flow so I'm going to automate the UI making use ensuring that the interacting with the buttons these elements are working as expected. And once again Nova is capturing this entire session, including the technical identifiers associated with each element. Nova is also able to capture any swiping or any gestures, so swiping and scrolling Nova can capture that as well. And those tend to be gestures that are actually kind of hard to automate. So it's very useful to make use of an auto script generator that can kind of capture those movements for you and kind of help help you overcome those hurdles of automating kind of hard to do gestures.
So with that, we're going to go ahead and once again go through this kind of getting start get started flow. We ensure that element that we are not interacting with is working as expected. Every time we tap on Element, Nova is capturing it. Nova captured the technical identifier associated with it as well. Nova is also able to capture other events such as an Appium. It's called Send Key's event. So any time you want to click into an element or an input field and then type out any numbers or letters you want to kind of send keys or send that that string into that input field. In an automated fashion. Nova is able to capture that as well.
So let's say I want to put in just like a dummy phone number to get started. Okay. Here. Within a manual session, you can make use of your own keyboard or you can also make use of the virtual keyboard as well. And then a few other notes that I know I mentioned and touched on this in the previous lesson or session. We do have a device inspector right within a manual session so you can actually inspect elements. And kind of. And be able to get the attributes associated with that element to also help facilitate your scripting as well. So if you were creating a script from scratch, maybe you wanted to go kind of interact with its elements and keys. You can find this element via X path or any other attribute that you might make use of in your script.
All right. So with that, I'm going to go and exit this session.
Were brought to our session overview. We have session explorer, but I'm going to go and just navigate straight to the automated test case tab. In the previous session, I demonstrated. How to run this via scriptless, so being able to scale it across multiple devices. Without writing a single line of code. And of course, with this lesson we're focusing on Appium.
So instead of running the rerun, a button here, I'll actually click on the export Appium script button. And here we have a full functioning Appium script generated for you based on that manual session available to you in just minutes. It will come zips will go to unzip this. Now on navigate to Visual Studio coder wants to get any idea of choice and I'll go ahead and open that script.
And here we are. We have it complete with the config file with your desired capabilities defined. .. with the design capabilities to find we have our test app that kind of goes through that manual session that I had just performed. So once again, that says each test step that we're we're doing it is. Touching or tapping on the technical identifier. Associated with that element. And so now I have the entire manual session, the UI automated and available to me once again and, and just a few minutes.
Of course, this was a very basic, simple test, but no, NOVA our AI engine Kobiton's engine is very robust and being able to generate this Appium script in a very in timely manner, it saves you a lot of time in scripting from scratch. So if you were to script this out from scratch with the desired capabilities, with everything involved in importing the necessary dependencies and, you know, starting from scratch in that nature, it can be very time consuming and tedious.
So here we have artificial intelligence essentially doing the automation process for us by automating or by generating the script. So now I have saved myself hours of time. I can move forward, I can file the script away. We did download it in TestNg, which I forgot to make note of that. So as we download the Appium script, we have testing frameworks to make use of as well. So TestNG or Junit. So this Appium script did download and the Java language Appium is more of the driving framework, so be able to drive the that script on a real device. And then we have testNG, which is more of the testing framework. So you can actually organize your test cases, be able to maybe run your test cases in parallel across to other devices, etc., making use of a testing framework such as TestNG.
What's great about this Appium export is that if we want to navigate to this POM XML. It has all the dependency, all the additional dependencies already essentially defined for you within this Appium script. And what I mean by that is there are a few other dependencies to make use of where you'd have to traditionally have to manually navigate to a repository and essentially incorporate it into a script here in the Java export. Our AI engine has already done just that. So we have the testNG dependency within our script. We have the Selenium dependency in our script to make use of the Selenium WebDriver. And we also further have the Appium dependency within our POM file as well.
If for some reason you find your script or maybe you're scripting from scratch and you do not have these dependencies in place, that's okay. You can simply edit your POM file, navigate to this repository and ensure that you have the correct version that's relevant to the versions you're working with. And essentially just add it into this POM XML in the same format that you see here. So with that dependency and then kind of defining that dependency. But like I said, once again, this Appium script that was generated has all the dependencies in place for you.
All right. One of the reasons why I enjoy or I like to use Visual Studio code is that there are a lot of great plug ins and extensions for you to make use of. So one is the test runner for Java is a great extension for you to run as well as debugging in Java also. And then there's also a Maven plug in for Java as well.
So if I navigate back to the config file, this script is ready to run. We have Appium installed. We have our environment variables defined and configured. We will be able to rerun the script if we want to run it on the same device. Or if we want to run it on an A on a different device. So within our design capabilities, that manual session, it did capture device we ran it on as well as the application that we're making use of. But let's say we want to run this on another device. We can simply navigate back to the Kobiton portal, navigate to devices. Let's say I want to run it on this galaxy S10 e. I can navigate to automation settings season. And here we can. Copy the desired capability relevant for the language we're working in, the framework we're working in, and the relevant information regarding that device. Hit copy. And I'm going to paste it and clean it up just a smidge.
All right. And the last thing we need to do is we just need to implement our API key. So making use of this Appium script that was exported. We want to ensure that we are being able to hit the devices we're defining and we can do that by ensuring that we have access to the Kobiton portal. So we have the Kobiton portal defined here or excuse me, not, not portal the server. We have the Kobiton server defined here. It's going to make use of our username as well as our API key. So here you can see the script itself is missing that API key. We would have to modify it and implement our API key. We can do just that. We navigate back to the portal. And we go to settings. We have our default API key here available to copy and paste into our scripts.
Okay. So we're ready to run the script. Another thing I want to quickly make note of is traditionally via Appium, you would need to actually have additional step of starting the Appium server and kind of moving forward and defining certain ports for running Appium scripts.
Just want to remind you all once again that using Kobiton and hitting that Kobiton server, you'll be making use of XIUM. So Kobiuton in-house built Appium server. It is a drop in server, so there is no additional step to initiate or to start that server. It will go ahead and once it hits the Kobiton it will run through XIUM. Now if we navigate to the testNG testing file or I'm sorry, tab tab here, we can go ahead and run our Java project. And so with doing this, this will run our Appium script. It'll hit our the Kobiton server and make use of real devices as well as XIUM to run your Appium script up to three times faster.
So here we find the device. So again, we did take it to that Galaxy S10 E and we began running our Appium script. Here. You see, it's initiated. It's actually initiated the Java client for Appium. Now I'm going to go through each test step that I performed it. Now it's automated and it will go through each test it. As I mentioned previously, there was that send keys event. Any time we input a text or string into an input field, so the Appium and syntax for that is to send keys. So once again, the script has captured that and we see that our script passed. It has run that Appium script on an additional device.
Now if I navigate to the Kobiton portal. And navigate the sessions. I can see the automated script that I had just run, so automated test session or Appium script that we just ran on a real device. And if we were to click into that session and get all the awesome rich reporting that would come with any session and Kobiton manual our scriptless. You also get that available with our Appium sessions as well. So a full playback video of the script you just ran. You have such session explore as well to really showcase how your Appium kind of they. All that rich information regarding that session, even on an Appium script, is also available to you within Session Explorer as well.
So we have set up our environment, we have Appium installed, we have Java installed, we're able to run that Appium scripts. We ran one manual session that generated this Appium script. And with our environment and set up, we were able to run that Appium script, or we could even edit the script and kind of dove deeper into scripting.
So in the next session, review a little bit more about XIUM as well as all the great features that AI can provide within Appium script. So such as Flux Correct, which is our self-healing feature. So Flux Correct will essentially catch your script from falling excuse me, failing due to the instability or due to the brittleness. You know that element not found on page with flex correct enabled, it can actually find the next best fit identifier and inject that into your script so your scripts keep running. And then we also have previously in the previous lesson I showed you all validations with scriptless automation. We do have that relevant for Appium scripts as well, but only at the moment for visual and text. So we have that as a desired capability.
We could also use this Appium script or any Appium script as a baseline so we can run an Appium script, use that session ID as a baseline, and then further run additional sessions that we can compare against to also possibly bring about any text visual issues regarding the scripts. Or excuse me, regarding your test case.
So once again, we have everything set up to run Appium scripts making use of Kobiton and Kobiton and running your scripts on real devices.
Comments are closed.