How to call JSON data with a method in appium python - appium-android

I need to use JSON file to store the desired caps both for ios and android and use it in my pytest. What is the best way to implement it for running automation tests?

Related

Can Flutter application function in the background?

I am new to flutter.
I want to build a map application that shows collectable items on a map. When the users are near the item they can collect them. I have to make call to server to indicate that user collect the item.
I understand the application will function when it is in the foreground. But if the application is in the background can it perform these functions? For example: update users location, get items based on the location, collect items etc.
Does flutter can perform these functions normally if it is in the background or we have to create say some service type of application to do this?
I appreciate any advice regarding this.
Yes, you can do it, but you will need to create this methods with kotlin / java and use the platform channels to invoke it.
Yes you can workmanger is for running something on the background in your flutter app and it supports dart directly Workmanager. Alternatively native code will work for you swift or objective-c for ios and kotlin or java for android depending on which default native languages you tell flutter to create project with but that becomes very complex especially over ios side if you have no prior experience. Try your best with workmanager see if that can work.
Put a look to firebase schedule functions and cron as well see if they can do the job as well for you
Firebase Schedule Functions
Cron Flutter

How I can save JSON Api on device and use it when the device is not connected to internet

I tiring to made app that get data(Images and titles) from a web site as json api and put this data in a ListView bulider,
but I want to save the data on device first to view it when the device isn't connected to the internet and I want the data who I save it , be different order
You can use the Shared Preferences Package to store a Map
on the device.
I recommend reading Data Persistence with Flutter in the Cookbook. This will show you how to tackle this.
You could use SQFLite if you are familiar with SQL or Hive if you prefer to stick with pure dart

How to communicate with the app from a Flutter integration test

In a Flutter integration test, I would like to communicate with the application in the middle of a test, in order to trigger some arbitrary code to simulate a scenario. Is there a way to achieve this?

How can I see the order in which methods and functions are called in my application?

Is there any way in Xcode to see which functions get called in sequence, from start to end? (For example: the main function calls the an app delegate method, and so on.)
Can you do this using breakpoints, or is there another way to achieve this?
Use instrument for that. You can access it from Xcode by asking Xcode to run your application using instrument.
or you can type bt in xCode console
If running in the iPhone Simulator, you can use a custom instrument build with DTrace for doing just that. I provide the code and setup steps for building such an instrument in an article on MacResearch here, or you can just download the custom instrument template here.
This particular template will list, in order of execution, every method called on every class from the launch of your application until it is ready to take user input.
Unfortunately, DTrace does not yet work on the iOS devices, so you can't run a custom instrument like this against your application running there.
(Update 10/4/2011) I propose what is probably a better way of handling this in this answer to a similar question, which uses breakpoints instead of DTrace.

Designing iPhone/iPad apps for testability

I'm currently using GHUnit and OCMock for testing my app. I'm using them because I like the fact that I can run test code on the actual device.
The way my app is currently designed is that I have some central services and objects available through properties on the app delegate. For example, I've centralised some core data functionality which can be accessed by [UIApplication sharedApplication].coreData.
The problem I've encountered is that in order to run unit tests on the device or simulator, GHUnit uses it's own app delegate which doesn't have these properties. So if a unit triggers code which wants to access them, it fails.
So I'm looking at the design of the app and wondering if I should redesign the way these core facilities are made available. How do you guys design your apps?
One thing I'm considering is extracting this functionality out to a separate object so that I can then use OCMock to simulate it for testing purposes.
Any thoughts?
After thinking about this a while I realised there was a simpler solution. I created a category with the app delegate's interface which applies to the GU Unit app delegate used when running the tests. This way I can get the tests to run and use this category to return OC Mocks when necessary.
And another technique. This time I extended the GH Unit test iPhone app delegate and added the methods and properties I needed. I then modified the main class to call that instead of the original.
Ahhh, so many ways to achieve the same result :-)