iOS: Fetch logs from Instruments in txt format - ios

Is there any way i can fetch the test cases logs that are generated from Instrument in text format. I want it to be passed on to a text file so that i can read them and create a Test Report.

Some (but not all) tools in Instruments support exporting to CSV.
To do so, select the instrument you want and click
Instrument -> Export Data for:

Related

Saving the data of a table view in Swift 3

I'm trying to build a simple to-do list app with Swift 3 and Xcode 8. It includes a text input box, a submit button, and a table, where each cell includes a title and a subtitle that shows the date. So far, all of this has worked.
Currently, I'm trying to get it to save when I leave the app. I've tried user defaults (which I have succesfully used in the past, but wasn't working for this), core data (which seemed like a lot of excess code, will do if I have to), and a JSON file I tried to read and write from with SwiftyJSON (have also succesfully used this). None of these have worked.
What would be the simplest/best way to solve my problem?
Thank you!
The simplest way to persist data locally in those circumstances is probably to use NSCoding. See the "Persist Data" section in Apple's Start Developing iOS Apps (Swift) guide.
You might also want to take a look at Apple's sample code Lister (for watchOS, iOS, and OS X), which demonstrates a productivity app for iOS and OS X that enables you to create and share to-do lists across devices. A user can store their documents both locally or in iCloud, but this may be more than you need for your use case.
You can save your data into: userdefaults, files in documents folder, coredata, SQLite db, third-party like realm. You can send also to your remote server.

Instruments Automation saving options

I'm new to Instruments Automation. After finishing a script I decided to save my work but see two options 1.) save as 2.) "save as template"
I noticed that when I choose save as it creates a "Trace Document" while save as template saves as "Trace Template"
What is the difference between these?
Save saves your trace data so you can examine it later.
Save as template saves the trace document's instrument list as a template you can choose from when you choose Product > Profile in Xcode or File > New in Instruments.
If you find yourself constantly adding instruments to the trace or removing instruments from the trace, saving as a template frees you from having to add or remove instruments every time you trace. Suppose you're profiling the performance of an OpenGL game and you want to use both the Time Profiler and the OpenGL Driver instruments. You'll notice Apple does not provide a template that combines both of these instruments. You can set up your trace to use both instruments and save as a template so you don't have set up the trace every time you profile your game.
Considering the Instrument named Automation for UI interaction simulation: If you want to save the script itself as a javascript source file, do right click in the script pane, and select Export. Then you can open the file again by tapping the Add button and the choose Import.

Is there a way to launch automation and allocations tracetemplate using Instruments simultaneously?

I am trying to use Automation instruments together with Allocation instruments to profile the memory usage of our iOS app. The idea is to use Automation to drive the use cases, while the Allocation instruments record some memory data in the background. I am wondering if is it possible to launch automation and allocations tracetemplate using Instruments simultaneously? So that I can check the data recorded by Allocations after the automation is done.
Any pointers would be helpful.
Choose the Automation template. Click the Library button in the toolbar to get a list of available instruments. Find the Allocations instrument in the Library and drag it to the instruments list on the left side of the trace document window. You could also reverse this by choosing the Allocations template and dragging the Automation instrument from the Library.
After you add the second instrument from the Library, choose File > Save As Template to save your trace as a template. When you profile your app in Instruments, your template will appear in the list of available templates in the User section. Saving as a template keeps you from having to add a second instrument to the trace every time you profile your app.
#Assassin, I also have to do this for test automation and I ended up writing an AppleScript to export from the command line, as it looks like Apple doesn't provide any other way to do this. My bash script to do this part looks like this:
open file.trace
sleep 10
osascript InstrumentsExport.scpt
And then I have some fancy awk commands to parse the resulting CSV file. My AppleScript to export to CSV looks like this:
tell application "/Applications/Xcode.app/Contents/Applications/Instruments.app"
activate
end tell
delay 3
tell application "System Events" to tell process "Instruments"
set frontmost to true
tell menu bar item "Instrument" of menu bar 1
click
click menu item "Export Track for 'Activity Monitor'..." of menu 1
end tell
delay 3
keystroke return
end tell
For the "Export Track for" text, you'll need to rename that to whatever it's called in your Instruments GUI, complete with "..." at the end.

iOS: Dumping debug data file from device to OSX

I am doing a lot of DSP work on iOS
So frequently I need to dump a file of raw floats, and pick it up in something like Audacity, to look at the waveform.
Even working on the simulator, this is a PITA. I need to log the destination folder to console, open up Finder, CTRL+CMD+G, paste the destination folder, drag drop all of the files onto the desktop, open up Audacity, import them one by one manually correcting the format.
( Why can't I just point Audacity to the right folder once? because the iPhone simulator stores its data somewhere hideously deeply nested that involves a hidden folder, so I can't see it with the audacity file browser )
( Why is the format wrong? Because audacity tries to figure out the most likely format, and if my data starts off random which it often does, it will invariably get it wrong )
However, working on the device, I can't even see a way to get at these files.
What are my options? I am looking for maximum automation, as I do this typically hundreds of times in a particular job.

Access apps with AppleScript

Is there anyway to programmatically get a list of iOS apps from iTunes?
AppleScript does not seem able to do this.
The only way I can think of is looking in the 'iTunes Media/Mobile Applications' folder. But this way a lose all metadata.
Any suggestions to get list of iOS apps including the metadata?
Thanks
I now actually went with the solution to scan the 'Mobile Applications' folder.
In order to get the metadata I had to do the following:
the *.ipa are simply archives
unzip/extract the 'iTunesMetadata.plist' inside
parse the plist
voila you got all metadata
This whole process is actually pretty straightforward in python as your already have both zipfile and plistlib.
One thing to lookout for though is that plistlib in python can not handle the new binary plist files. So you first have to convert them to their corresponding xml format. (only some *.ipa seem to be in binary form).
This can be done quite easily with the following line of code:
os.system("/usr/bin/plutil -convert xml1 %s" % file_name )
Now the only thing I still have to figure out is how to get the currently installed apps on the device...

Resources