Code coverage mechanism

Hi guys,


I'm an automation tester and completely new with iOS development. I'm using Appium to automate test cases on Android and iOS.


I have some questions to make clear about code coverage machenism of iOS.


As I understand that to generate code coverage xcode will do steps as follow (please correct me if sth's wrong):

- Instrument source code

- Build file .app and install on simulator

- Execute Unit Test/UI Test and generate data files .profraw

- Generate .profraw files to code coverage in .html format.


Questions:

1. Where are .profraw files saved after test?

2. Which tool/framework to generate .html code coverage report? And command line?

3. What happen if I build .app file using command like this

xcodebuild -enableCodeCoverage YES clean build

then execute test on simulator manually, is there any .profraw file created?

4. Is there any way to get code coverage report in End-To-End Testing, not using Unit/UI Test with XCTest?