Forum Discussion

mazhar555's avatar
mazhar555
Contributor
15 years ago

How can i change the test log/result as per my need

Hi, as i have to check certain requirements i have to add few if conditions due to which for test complete the result is FAIL but for me it is working fine means PASS. Now i want to chnage the test log means i want to convert this Fail log into PASS log. Hope you understand my requirement. I am sure we can do it in QTP like me can change the test result report as per our need i dont know how to do it in Test Complete?

10 Replies

  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hi Muhammad,



    This is not possible in TestComplete.

    The general idea behind this (as per my understanding) is that if something in the test went not as expected by the test then this may be a problem that should be indicated (as a failure test result). If, after investigation, it appears that the tested application's behaviour was correct and the problem was caused by the test's shortage then the test should be corrected and test should be re-run.
  • As part of project requirement I need to customize the test resut give it in html format or any other format.

    1. i need to give count of  Script executed

    2 script passed

    3. script failed

    4. description of each step

    4. If script got failed means screen shot needed

    Is there is any possiablity to give test result like that?
  • Hi

      

       I am facing some problem in TC while using framwork.

        I am using testcomplete 8.0 using implemented with framework.  I am having driver script  calls  the function which is given below.  like login few action will be there. after driver script ran the project log and test log result contains Driver script main function name .  programatically wrote generic function  export the result to testresult folder consist of folder names with  "ExcelName+TimeStamp". 



     In this way i got testlog result but I couldn't get project log result ( list of test script ran, status count by pass fail & warnings ) because all ran project log result consists of Driver script main function name only. 



      1. Any one guide me how to programe in such a way to get above project log result by using TC builtin function.  Is there is any function to alter the project log name. 

     Whenever test got failed I couldn't get test log result with specfied format. once test execution got interupt onstopTest event will trigger In that event I call this export function. I called like that testresult folder names with undefined +timestamp. 

    2. How can a pass current execution excel or excel-sheet name to event handler?  suggest me some better option.





    login.xls






















































    ScreenName Function Name Window Name Object Name DataSet1
    Log into application and Navigating to Home Page.        
    User Signon ID txt_SetText     dpl
    password txt_SetText      1234
    OK btn_Click      
    #Now verifying for the correct login      
    ExcelName ExportResultHTML    
  • Hi,



    How do you launch your script? Do you run an individual routine or the entire project/suite?



    Also, can you post your script here?
  • I invoke  the TC and Project suite -> driver script main function thru startup script then this driver script will run.  for every test runs DriverscriptMain function name is getting displayed in project log. Instead of DriverScriptMain name if it displays csv file name "login" it will be useful to get project log. because I export the test log based on csv file name only. If project log consists of this csv file name means I will easily retrive the project log.



    //USEUNIT Function_Generic

    function AppScriptDriver(CurrentDriver)

    {

    var ScreenName = DDT["CurrentDriver"]["Value"](0);

    var FunctionName = DDT["CurrentDriver"]["Value"](1);

    var ObjectName = eval(DDT["CurrentDriver"]["Value"](3));

    var DataValue = DDT["CurrentDriver"]["Value"](4);

    switch (FunctionName)

        { 

        case "TxtSetTxtboxValue":

        TxtSetTxtboxValue(ObjectName, DataValue, ScreenName); 

        break;


        case "ObjClickObject": 

        ObjClickObject(ObjectName,ScreenName); 

        break

            

        case
    "AppExportResultsHTML": 

        AppExportResultsHTML(ScreenName); 

        break;


        default

        Log["Message"]("Invalid Function selection"); 

        break;


        }


    }



    function DriverscriptMain()



        var Driver;

    // Creates the driver 

        Driver = DDT["CSVDriver"]("C:\\testset\\Login.csv");     

    // Launch the Application

        AppLaunch();

    // Iterates through records 

        while (! Driver["EOF"]() ) 

        { 

            AppScriptDriver(); 

            Driver["Next"](); 

        }

    // Closing the driver 

            DDT["CloseDriver"](Driver["Name"]);

    }


  • Hi,



    The name of the log is based on the item you run (project, test item, script function, etc.). There's no way to change it.
  • Hi jared



        For generating Test Log result I used SaveResultAs Function at the end of the each script.  if script ran successful then I will get test log results.  If test script is intreputed then I couldn't get the test log result.   In that situation I create event handler for OnStopTest Event inside this event I used saveResultAs function  in case I couldn't  pass the current scriptName  as parameter. 



         In Failure senarion I didn't  get test log rest by script name or function name.  suggest me  How to pass the current scritp name or function name to event handle to invoke  function to get test log result in failure senario too.  suggest me some better option.
  • Hi,



    There's no way to pass the current function's name to the OnStopTest handler. You can try using a project variable to keep this name and update the value of this variable in each function. When OnStopTest is called, read this variable's value and use it in the event handler.
  • Hi Bala,



    If you want to export your result to a .txt or .csv file its better to write your own routine, you can export the TestComplete Logs but in most of the cases it does not fulfill our need because as a tester we need Pass or Fail status against each test case.



    Well i am not sure how you are managing your test data but i can explain how i am generating test result in a seperate file.

    Suppose we have a login test case with the following Data coming from excel sheet



    Test Case-ID              Login Name              Password         Expected Result

    01                               Test1                        Test0                Error Message: Incorrect Login information





    So now if your system is prompting this error means ur test case is passed if not your test case is failed. Right after pressing the Login Button i am checking the error message and calling the following routine, if error message is there i am passing "Pass", otherwise "Fail".



    If ErrorMessage = ExpectedResult Then

        LogResultIntoFile "Login",TestCaseID&","&"Passed"

    Else

        LogResultIntoFile "Login",TestCaseID&","&"Failed"

    End If 



    Function LogResultIntoFile(Module, Result)

        CreateFolder "C:\TestResults"

        CreateFile "C:\TestResults\"&Module&".csv"

        OpenFile "C:\TestResults\"&Module&".csv"

        writeNewLine Result

        CloseFile

    End Function



    (it is just an example not a complete solution)