I have to verify whether one label in the app matches the referenced image or not.
So please tell me how it can be done using UIAutomation.
Thanks in advance.
Your only hope using just the xCode Instruments software is to use the UIAHost.performTaskWithPathArgumentsTimeout function. You'll have to send the screenshot (which you can take inside of the Instruments software) to an image processing script that you've written and have saved in some accessible location and then return the result. If you use a large enough timeout you won't want to worry about the script moving on before getting the result back from your outside script.
I think, but am entirely unsure, that there are third party automation softwares that include image processing stuffs.
Related
I am doing iOS UI testing with XCUITest.
Since we do not have access to the app, how do we set defaults to the app?
You can pass all the required data using launch arguments.
Please read documentation
https://developer.apple.com/documentation/xctest/xcuiapplication/1500477-launcharguments
The other (and a bit slower) option is to use deep links.
This sounds much more complex than it is, but a technique that has worked for me is to set up an HTTP server in the testing suite that you can use to fetch mock data in your test code. I have had success with Embassy and Ambassador.
So you'd pass in a launch argument telling your app code to fetch from the server. For the case of UserDefaults a helper class for making these specific requests to the local endpoint works well. This unfortunately means your app code has to be doing some setup for testing, but depending on your needs it could be a good compromise.
Another possible solution to crossing the process boundary:
If you are not doing on device testing, you can access "SIMULATOR_SHARED_RESOURCES_DIRECTORY" and provide the data in a file for your test to consume.
On a real device this would be more difficult because you would need to use a shared Group container.
You probably can use "Application Data Package". It's when you save your app state into a container and then run tests with the saved environment.
There are many guides how to do it, that's just one of them:
https://www.codementor.io/paulzabelin/xcode-app-data-suni6p4ma
It might me a more powerful and overcomplicated thing that you need, but opens a big world of possibilities ;)
I want to make an app which compiles Swift code, so how can I use a website named www.swiftstub.com or any similar website to retrieve the output of the code? I want my app to have a simple UITextView in which the user can type the code. If a UITextView cannot be used, what can be used?
I want my app to send the code typed to this website, and then retrieve the output back and display it. How can this be done? Thanks!
Make an app that sends text to a server.
Have the server compile this code, run it, and capture the output.
Send this output back to the app.
Have the app display the output.
This is an extreme oversimplification, there are lots of things to consider, but these are kind of the big sections of whats there to to. You need to understand very well on the app side: UI and networking, and on the server side: triggering a compilation of text, capturing that output (command line, maybe Swift or Python can help you here) and HTTP(S) responses and requests (or sockets, even harder).
This does not sound like an easy task, so you are very courageous.
Build all components locally:
App:
- write an app with a textView and a button, and on the tap of that button, save the output to a textile. This is to avoid any networking complications at this point, later, instead of saving, you would send this to a server.
Server: (just build the things on your computer)
- write some script/program that can read in that textfile that was saved.
- Then you need to compile this code (lookup 'xcrun' on google) and capture the output. Save this output to a textile. Have your app load this file and display it.
The important thing to consider is the real server machine you will run this code on later: it has to be a machine that can compile, and execute Swift code. Currently, this means it has to be an OS X machine. This is hard to find, as most servers run linux, and there is no Linux Swift compiler yet.
Getting this to work would be a proof of concept: you can capture text from the app, you can grab this text and compile it, you can capture the output of the compilation, and you can have the app read that output and display it.
Once you've got this working, you would need to find a server that can do the compilation part, and run what you build to do that. Then you would need to write some code in your app that sends an HTTP request to your server containing this text, to which your server would respond with the output of that compilation.
As I said, this is a big undertaking, with lots of difficult parts and unexpected surprises, so don't expect this to be done in a couple of weeks, it will most likely be more like over six months.
Try to find someone who has experience on programming and setting up a server, that will really help you a lot.
I run a successful Minecraft Tekkit modded server with computer craft on it.
I'm fairly new to lua and only know the basics, I'm trying to make a menu with pages to display the banned items list and rules list on. I've made a program with arrows that's optimized for advanced computers and monitors.
The code runs properly on my advanced computer but doesn't run on the monitor, when it shows and someone clicks the arrows it doesn't work either.
I just started using stack so I'm not sure on what to do, if you need any info please ask for it :)
The code: http://pastebin.com/gVtPeBCE
By the way I already tried using Mon.write and Mon = peripheral.wrap("top")
For those who don't have tekkit here is a computercraft emulator: https://goo.gl/J0dPq0
I'm sorry to inform you that I haven't read through all of your code. But judging based on your description, I would say that it's likely one of three issues, not including incorrect syntax as a possibility.
Note: Your question is exclusively asking about the programs ability to run on a monitor while the emulator you link to only provides the desktop ComputerCraft computers.
Peripheral
Although you already stated:
By the way I already tried using Mon.write and Mon = peripheral.wrap("top")
I would like to clarify that you can, as a way to simplify the code transition, set the peripheral function table equal to the term variable. For example: term = peripheral.wrap(string_side).
Note: When you use this method, you shouldn't execute the program with the command:
> monitor side program.
You should instead run it as a normal program with no special treatment.
I.e. > program.
Incorrect Mouse Event Detection
Simply put, when using a monitor, you're not supposed to pull for a mouse_click event. You have to pull for a monitor_touch event instead.
while true do
type, side, x, y = os.pullEvent()
if type == "monitor_touch" then
print("Monitor '"..side.."' has been pressed at "..x..", "..y.."!")
end
end
Monitor Size
This just simply means that the program you're trying to execute on the monitor takes up to much space and is therefore unusable when displayed on that size of monitor.
Suggestion: Either update your code for the monitor size or build the monitor to fit the program.
Please remember that all of these ideas might not answer your question, as the code you have provided to look over is too large and I haven't been able to find the time to experiment with it. Therefore, these are only general suggestions.
if i had to guess, it's because term is short for terminal and will auto work with computers so if you set term to be the monitor at the top of the file it should work correctly.
term = peripheral.wrap("SIDE OF MONITOR")
Put that at the top of your code and it should work. but this what i think it is after taking a look at your code (also its not that long of a code sample...)
I require my app to Scan barcode automatically , i have the barcodes, i have the app required, how can i make the App read physical bar codes using automation in appium,
In manual i can scan the code by pointing out the camera to an bar code.
I dont know how to do it while executing an test suite.
i got idea of placing Mobile device on an Stand, tripod and placing barcode in front of it.
But the problem is we can test only one barcode. i want to run for about 100-200 barcodes ans see app performance does not decrease, can any one suggest some ways?
This is a very interesting case. If you really want to test your app scanning the bar codes through camera then I think instead of looking for a solution through appium you have to look for a solution to exactly match your manual process.
You can click scan button using appium(I assume) - for example you can write a script to click on this button every 10 seconds.
Challenge is to point the camera to the next barcode as soon as first scan is complete. Possible solutions- I believe that all the bar codes can be captured in a file in a pc. Copy these bar code images in a ppt or using any other program so that these images can automatically displayed one by one.
Put your device in front of this pc as you are already planning to use tripod stand etc. Focus them on screen(may be first time you might need to do all these adjustments). Run your script. Do some trial runs. Synchronize the process with correct time outs. I think this should be feasible though really not the best way to automate this scenario.
I haven't tested it, but this blog post can be your answer http://www.mobileqazone.com/profiles/blogs/simulating-camera-in-android-emulator. If not, you can try bypass it by creating API to upload an image to your server instead of reading it from the camera. I think the impact on your QA will not change dramatically (besides, it's very easy and fast to check that part manually)
We do have an app that scans plenty of items such as bar codes plus tracking the dimensions of objects through the camera.
I read the idea of synchronizing images into a slideshow which is absolutely hilarious. The way I do it, is by using my own node server app with websockets that will toggle images through http requests. When this app is hosted in a laptop/ipad positioned exactly in front of the AUT, the test will have full control on which barcode to be shown at particular time frame.
No synchronization required at all and does the job.
It is a modified version of https://github.com/JangoSteve/websockets-demo
This is absolutely driving me crazy. While I'm a fan of the availability of asynchronous calls in AIR, I'm finding that being forced to use them for something that should be SUPER simple is a severe limitation. So severe that I may end up abandoning AIR and writing native Android and iOS apps instead of using the shared AIR platform.
OK, now that I have that off my chest, here's what I'm trying to accomplish. I have an app that, when deployed, is relatively small. But once deployed to a user's device that user will log in using a login name/password. Once they log in, content specific to that user needs to be downloaded and saved to the local device. Since the content varies by user I can't include it in the package for deployment.
But I cannot figure out how to accomplish this: say I want to download 10 files and each file is 2-3mb and I want to show a "Downloading, please wait..." view during the download. The application cannot proceed until all 10 files are downloaded. But since from what I've seen URLStream and URLLoader are both async I cannot figure out how to block the app from opening the "View available content" and say on the "Downloading, please wait..." view. Can anyone point me in the right direction??
I am new to AIR/Actionscript, but am a seasoned developer. Perhaps too seasoned in my old ways to think of an elegant solution to the above!
I would take a look at BulkLoader with a combination of dispatching/listening for completion. That way you can update the progress meter if you want, so on. Hope this helps.