Forum Discussion

amithsid's avatar
amithsid
Contributor
11 years ago

Need assistance in creating a log

Hello, I have automated a testplan and now I need to work on the reporting part. I want a log folder to be created in the name I specify and all the screenshots I take should be in the same ...
  • karkadil's avatar
    11 years ago
    Here is an example of 2 functions which do what you want and an example of testcase which uses these functions. The result log will look like in the attachment.




    var STEP = 1;


    var TC_ID;


     


    function Step(sDescription)


    {


        var oAttr;


        oAttr = Log.CreateNewAttributes();


        oAttr.Bold = true;


        STEP_ID = Log.CreateFolder("***Step #" + STEP + ": '" + sDescription + "'", "", pmNormal, oAttr);


        Log.PushLogFolder(STEP_ID);


    }


     


    function EndStep(sExpected)


    {


        Log.PopLogFolder();


        Log.Message("***Expected: '" + sExpected + "'");


        STEP++;


    }


     


    function testcase1()


    {


      Step('First step of the test case 1');


        Log.Message('Some actions');


        Log.Picture(Sys.Desktop.Picture(), 'Screenshot of the desktop');


      EndStep('Expected result of the step #1');


      


      Step('Second step of the test case 1');


        Log.Message('Some actions');


        Log.Picture(Sys.Desktop.Picture(), 'Screenshot of the desktop');


      EndStep('Expected result of the step #2');


      


      Step('First step of the test case 1');


        Log.Message('Some actions');


        Log.Picture(Sys.Desktop.Picture(), 'Screenshot of the desktop');


      EndStep('Expected result of the step #1');


      


    }