Script Editor can show the intensity of used/looped in runs.

The idea is next level User Interface shizzle…

But it would we awesome feature if it worked.

The idea is as following. By means of a shortcut you can show for a second, minute, or constant, what the intensity of a section of a if then else else if etc. part is of a code script is hit when run

image

image

A if else section that almost never is used is color yellow.
an if else section that the browser always goes into is red

image

I hope the idea is clear…

1 Like

This would mean there is a storage of your previous test run in order to make the needed comparisons AND that storage would likely be on Katalon’s servers. That would also mean a paid subscription.

Personally, if I have created code to use an if block or switch case, then at the time, I believed it was a possibility, especially using the default (in switch case). I couldn’t care less if it was never used–it is/was a possibility and painting it wouldn’t mean it was any less useful.

Edit: you were asked to put all your ideas into one posting so that it would be easier on Katalon staff. By all means, copy and paste this to your one posting that would be your proxy.

Very clear. It’s very like a heat map.

In my Katalon test code, this would be very easy to add. I didn’t like the way Katalon organized its “steps” so I wrote my own – therefore I could add this kind of functionality relatively easily.

In your test cases, and to continue using Katalon’s notion of “steps”, you would need to learn about implementing groovy metaprogramming, creating metaclasses and methods that “wrap” the core Katalon implementations.

Can and could be done, but that’s a LOT of work.

My guess is, @valentijn.peters has some “defensive coding” going on… covering “just in case” stuff with conditionals that might not be needed. I’ve done it when testing new stuff I’m not sure about.

1 Like

Instead of waiting for Katalon staff to implement this, why don’t you just read/write the number of times a condition is used to a spreadsheet or text file and then review it.

Maybe like:

You will need to create a spreadsheet and give the routine a pathway to that spreadsheet. I just used “Sheet1” as the first sheet but you can create multiple sheets, one for each condition but you will have to supply the sheet name as well with the parameters for your Keyword/routine. You can also have a parameter for more conditions.
“Read the numbers in”

import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.xssf.usermodel.XSSFSheet
import org.apache.poi.xssf.usermodel.XSSFWorkbook

gTestPathWay = "G:\\Katalon Test Cases\\Data Files\\Test route.xlsx";

@Keyword
public List<Integer> ReadCondition(String gTestPathWay, int routeCount ...)
    FileInputStream fis = new FileInputStream (gTestPathWay );
    XSSFWorkbook workbook = new XSSFWorkbook (fis);

    List<Integer> intRouteWay = new ArrayList<Integer>();

    XSSFSheet sheet = workbook.getSheet("Sheet1");

    for (int cnt = 1; cnt <= routeCount ; cnt++) {
        // start at cell A2;
        Row row = sheet.getRow(cnt);
        Cell cell = row.getCell(0);
       intRouteWay.add( cell.getStringCellValue() as int)
    }
fis.close()
}

and you start it like:
gRouteWay = CustomKeywords.'com.tools.ReadCondition'(gTestPathWay , 3, ...)

The below is just a thought.to write your number back to your spreadsheet. You will have to flush it out what can be in the Keyword or 2 Keywords or whatever.

if (condition1) {
    // cell A2
    gRouteWay.get(1)++
   //blah blah
 
} else if {condition2) {
     // cell A3
    gRouteWay.get(2)++
    //blah blah

} else {
     // cell A4
     gRouteWay.get(3)++
    //blah blah

}

import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.xssf.usermodel.XSSFSheet
import org.apache.poi.xssf.usermodel.XSSFWorkbook

gTestPathWay = "G:\\Katalon Test Cases\\Data Files\\Test route.xlsx";

@Keyword
public void WriteCondition(String gTestPathWay, List<Integer> gRouteWay, int routeCount ...)  {
/* open connection to MS Excel, save condition pathway to sheet 1, cell A{whatever}, close connection */
FileInputStream fis = new FileInputStream (gTestPathWay );
XSSFWorkbook workbook = new XSSFWorkbook (fis);

XSSFSheet sheet = workbook.getSheet("Sheet1");
for (int cnt = 1; cnt <= routeCount ; cnt++) {
    // start at cell A2;
    Row row  = sheet.createRow(cnt);

    cell.setCellValue(gRouteWay.get(cnt));

    FileOutputStream fos = new FileOutputStream(gTestPathWay);
    workbook.write(fos);
    fos.flush();
    fos.close();
}

fis.close();
}

And then in Excel, you can have the values given colour with conditional formatting:

How to Use Color Scales in Excel (Conditional Formatting) (youtube.com)

1 Like

I’m not at that point/level of programming… yet…

But I really like the idea behind it grylion54!!

Thanks for taking the effort to answer so extensively! maybe some other Forum members appreciate it too.