I want to write tests for an iOS app that are location dependent, like if you are at place A (I mean geo-location) this testStep should fail and that one should succeed and in location B the situation is the other way around,
Is there a way to simulate being at a location for KIF tests, like defining a stepForBeingAtLocation , for the simulator obviously, and not by manually choosing a gpx file for each test separately,
EDIT: to make it more clear, I want to do it in my tests, so it should be done in my code or with calling an external script or in some automatic way, I want to run tests that should happen in different locations.
The iOS Simulator is able to simulate different locations.
Select the iOS Simulator app, and from its OS X menu bar, look under Debug -> Location.
Related
I am currently writing tests for my app on xcode, and was wondering if there is a line of code I could use that would run my tests using an pre determined location service? I know it is possible to do it manually by clicking on the arrow when the test is running, but i want it automatically? I cant find any documentation or similar questions online.
Anyone know of anything?
A quick solution to this is going on simulator > Debug > Location > Custom Location > Then add the Lat and long in.
I try to add UI test cases to our existing mac application. I already tried UI test cases for iOS, which includes the following steps
I choosed Appium instead of Apple's UIAutomator, because I want to maintain the same flow for our Android apps too.
To proceed the automation, I need to set Labels/Values/Identifiers to the elements. So that they can be accessible. We used drawRect method in most parts, so I followed this post to make drawed components accessible.
I can set/read elements in iOS. What I did is, whenever I draw an element, I simply created an UIAccessibilityElement and added in the corresponding view.
Now, I'm trying to write UI tests for our mac application. As Appium does not have support to the mac application, I considered to use Apple's XCTest UI recording/playback to automate my mac application.
Here is the steps that I took:
NSAccessibility is the class that provides accessibility to the mac application
With XCTest, If I knew a particular elements (say a button) identifier/label, I can proceed with automated tap action
Unlike UIAccessibility, NSAccessibility is a role based object. That is, we need to mention which type of accessibility element that we are going to define.
To start the automation process, I took my mac applications left panel, which has five buttons aligned vertically in it
I set identifiers to those buttons. Then I opened Accessibility Inspector and opened my mac app. The values are properly set.
Then I tried to use record option in XCTest. When tapping the button, crashes the app with the error
"Recorder Service Error: Left Mouse Down: Failed to find matching
element".
I posted about it here.
Questions:
Can someone suggest me the right path to automate mac application? Am I going in the right way?
I googled a lot to see a working sample code about how to implement NSAccessibility. But I can not found anything. Can someone share any useful links/samples?
All I need is, to get elements by identifier/label. Accessibility Inspector shows the right value where as XCTest can not read the identifiers. Did anyone face this issue?
Thanks in Advance
I have some kind of navigation app where I handle different locations. Is it possible in UI tests to simulate and even to change them at runtime? What would be the best approach to archive this?
I think the best approach to this will be to use GPX files. These allow you to set the lat and long of a location. (For more details see here: https://blackpixel.com/writing/2013/05/simulating-locations-with-xcode.html)
However, I suspect you will need to call these from within the app itself and then use UI testing launch arguments (when you launch XCUIApplication) to stipulate which GPX files to use depending upon the test.
See my detailed note https://github.com/onmyway133/blog/issues/45
You need to declare the gpx file in the app target, not the UI Tests target
Go to Simulator -> Location -> Custom Location to point to your location in the gpx. It is duplication, but without it, it does not work
If it does not work because of caching or something, run the app again, then run UI Tests again.
If it still does not work, reset simulator
You can create gpx file directly from Xcode
I am trying to use UIAutomation for testing an iOS 8 Today extension widget. I can change the target to the extension, launch it, but then unable to do anything after that.
Has anyone had any success in using UIAutomation with the extensions?
I hope I have the right end of the stick on this one.
I think you want to create a set of UI Tests which run like you can do with a normal application.
I found that I was not able to create a specific UI Tests target to then set the target application as WidgetExtension, as you would normally.
However I was able to set the WidgetExtension target to build and run onto a device (>= iOS 14) then within my UI Tests, I was able to record some steps which would allow me to write a clearer UI Test (place the cursor inside a test function to use record, you might already know this).
The tricky bit would be keeping the WidgetExtension target up-to-date onto the testing simulator to run your automated tests.
I am investigating the available testing frameworks for iOS,
I want to write tests for an iOS app that are location dependent, like if you are at place A (I mean geo-location) this testStep should fail and that one should succeed and in location B the situation is the other way around,
Is there a way to simulate being at a location when writing Frank tests, in the simulator, and not by manually choosing a gpx file for each test separately,
EDIT: to make it clear, I want to do it in my tests, so it should be done in my code or with calling an external script or in some automatic way, I want to run tests that should happen in different locations.
as of Frank 1.1.1 you can now ask Frank to simulate a location using the set_location method. For an example of how this works take a look at this step definition from the example app that comes with Frank.