Forum Discussion

Arunachalam's avatar
Arunachalam
Occasional Contributor
6 years ago

Script code for Checkpoint validation

Hi,

 

The output log of "aqobject.checkproperty" either success or failure log can be stored in any external excel file by using script code. If any Script is available to share it.

  • Wamboo's avatar
    Wamboo
    6 years ago
    function storeLogInExternalFile(Object, Property, Condition, Value)) {
    	
    	var obj = {
    		testItemName: Project.TestItems.Current.Name;
    		testItemProperty: Property
    		testItemValue: Value
    		theValueIsCorrect : false;
    	}
    	
    	(aqObject.CheckProperty(Object, Property, Condition, Value)) ? obj.theValueIsCorrect = true  : obj.theValueIsCorrect = false;
    	
    	let dataToExcel = JSON.stringify(obj);
    	
    	// put this data into file
    }

    or store data into long string and put it into one cell in excel and into another one the name of the test item.

    Check in documentation that connection between TestComplete can accept JSON object as parameter. If yes you have good example.

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hey,

     

    What exactly do you want to do with the data in the file? must be excel? in which language do you write?

    • Arunachalam's avatar
      Arunachalam
      Occasional Contributor

      Wamboo 

       

      1. Our framework script in Javascript.

      2. I need to store the log (which means success or failure ) into some excel sheet using the DDT driver method or any other method.

       

      • Wamboo's avatar
        Wamboo
        Community Hero
        function storeLogInExternalFile(Object, Property, Condition, Value)) {
        	
        	var obj = {
        		testItemName: Project.TestItems.Current.Name;
        		testItemProperty: Property
        		testItemValue: Value
        		theValueIsCorrect : false;
        	}
        	
        	(aqObject.CheckProperty(Object, Property, Condition, Value)) ? obj.theValueIsCorrect = true  : obj.theValueIsCorrect = false;
        	
        	let dataToExcel = JSON.stringify(obj);
        	
        	// put this data into file
        }

        or store data into long string and put it into one cell in excel and into another one the name of the test item.

        Check in documentation that connection between TestComplete can accept JSON object as parameter. If yes you have good example.