Forum Discussion

sunsmile's avatar
sunsmile
Occasional Contributor
16 years ago

Upload TestComplete Logs To Sharepoint

Hi,

Is it possible to upload TestComplete logs to SharePoint site from TestComplete(TestComplete exposed API's)?



If yes, can anyone point me to a sample code to get started?



Any further comments are welcome here.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Pradeep,



    Uploading to SharePoint server is more SharePoint's functionality than those of TestComplete...

    TestComplete provides you with the log that you can export to the format you prefer (see "Exporting Test Results" help topic for more details) and then upload obtained file(s) to SharePoint document library.

    A sample request to Google

    http://www.google.com/search?hl=en&source=hp&q=sharepoint+file+upload+vbscript

    returns several links that may be relevant for you.



    Regards,

          Alex

          [TeamAQA]

    ____

    [TeamAQA] members are not employed by AutomatedQA Corp. but are just

    volunteers who have some experience with the tools by AutomatedQA Corp.

    and a desire to help others. Postings made by [TeamAQA] members may

    differ from the official policies of AutomatedQA Corp. and should be

    treated as the own private opinion of their authors and under no

    circumstances as an official answer from AutomatedQA Corp.

    [TeamAQA] signature is used with permission by AutomatedQA Corp.

    More information about [TeamAQA] and its members is available at

    http://www.automatedqa.com/support/teamaqa/

    ================================

     
  • sunsmile's avatar
    sunsmile
    Occasional Contributor
    Hi Alexei ,

    Thanks for that information. I got the Logs uploaded to sharepoint using below code. I am posting the code for the benefit of the community. Please do let me know if there is scope for improvement. The code is in C#.



    function GeneralEvents_OnStopTest(Sender)

    {

     try

     {

       Log["SaveResultsAs"]("C:\\testcompleteLog.mht",2); 

      

       var objStream = Sys.OleObject("ADODB.Stream");

       objStream["Type"]=1;


       objStream["Open"]();

       objStream["LoadFromFile"]("C:\\testcompleteLog.mht");

     

       var sData = objStream["Read"]();

       objStream["Close"]();


      var strURL = "http://MySharepointwebsite/folder/subfolder/testcompleteLog.mht";

      var httpObj = Sys.OleObject("MSXML2.XMLHTTP");

              

       httpObj["open"]("PUT",strURL,false,"YourUserName","YourPassword");

     

       httpObj["send"](sData);

     }

      catch(Exception)

     {

        Log["Error"]("Failed Upload Logs to Share Point " + Exception); 

     }

    }




     


  • Jeniferanto's avatar
    Jeniferanto
    Occasional Contributor
    Hi , 



    I used the above code to postthe file in sharepoint. But after teh execution of the above code . 

    The page contents got displayed in binary code. 



    Can somebody tell me how to fix that. 



    I change the line - 

























    objStream["Type"]=1;   to  2. 



    But still not working. 



     










  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Jenifer,



    Unfortunately, I don't have access to the Sharepoint server now, so I cannot check if Pradeep's code works for me, but I have pretty similar code for AutomatedBuildStudio (ABS, http://smartbear.com/products/software-development/software-release-management/) based on these resources:

    http://stackoverflow.com/questions/3787870/vbscript-to-upload-file-to-sharepoint-doclib

    http://sharepointfieldnotes.blogspot.com/2009/09/uploading-content-into-sharepoint-let.html

    http://www.codeproject.com/KB/sharepoint/SharePoint.aspx

    and this code definitely worked for me several years ago.



    Hope, the mentioned resources will help you.