Capture Native app Screenshot and save in a Location


I am using Java for our Test Automation With TestNG using Appium Driver.
We have automated Sanity tests and On daily basis we run them first thing in the Morning.

Now i need your help as follows in providing me the code:
I am using MAC OS. we need to create a folder in Documents folder with name bearing today’s date and time(Ex:TestResults12092015) code should be placed in @Beforetest.

In @Test we should be able to create subfolder under folder TestResults12092015 with name bearing the Test Method name.

Each @Test has script for Navigation and Functional Validation steps. Here we should be able to take screenshot of the Native application where ever required and save in the subfolder as Screenshot1, Screenshot2 etc…



Create Folder(Need Code)


Create SubfolderWithTestmethodName (Need Code);
CaptureScreenshot(“Screeshot1”) (Need Code)

Appreciate your help!