How to store generated reports on a Network drive thru pom.xml file..??

Answered

Hi All,
1.I have a requirement that the generated reports should get stored on a “Network drive”. Currently we are running the scripts for every one hour thru pom.xml batch file. So the reports should get generate accordingly and should be stored on Network drive.
We are not using Ant’s build.xml. So how can we achieve this thru pom.xml.. How can I mention the path in that file. Could you please help me on this..

2.How can I access the Network Drive which will ask login credentials through Java code.?

Thank you.

  • 2 Answer(s)
    Best answer

    Hi Ravindra

    Regarding the question 1 , i think you already have some solution with build.xml
    In maven there is way to run ant task , you need to add plugin to your pom.xml
    More details on how to use the plugin can be found here :http://maven.apache.org/guides/mini/guide-using-ant.html

    Supporter Answered on November 7, 2014.
    Add Comment

    Hi..I got the the solution ..

    
    public  class CustomReporter implements IReporter
    
    {
    
    File fd = new File("");
    
    String date;
    
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd_hh-mm-ss");
    
    String folderNameWithTimeStamp = df.format(new Date());
    
    String currentDir = System.getProperty("user.dir") + "//Reports//";
    
    //    String finalPath = currentDir + folderNameWithTimeStamp;
    
    String smbUrl = "NetWork Drive path..";  //Before this You have to manually access the drive and enter the user name and password and mark the check box as remember my credentials.
    
    String finalPath = smbUrl + folderNameWithTimeStamp;
    @SuppressWarnings("deprecation")
    
    @Override
    
    public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory)
    
    {
    
    TestNG.getDefault().setOutputDirectory(finalPath);
    
    TestNG.getDefault().setXmlSuites(xmlSuites);
    
    XmlSuite suite = new XmlSuite();
    
    List<XmlSuite> suites1 = new ArrayList<XmlSuite>();
    
    suites1.add(suite);
    
    TestNG tng = new TestNG();
    
    tng.setXmlSuites(suites1);
    }
    
    

    Train Answered on November 18, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.