How to Pass a dynamic variable from one test suite to another?

This portion smells to me a bit.

The Data Files folder is not appropriate place to locate your own files.

Katalon Studio owns the Data Files folder as a temporary storage for “Data-Driven Testing” feature. KS does not expect users to locate their own files in the Data Files folder. Katalon Studio might do something myterious to the files in the directory, though I’m not sure, as Katalon’s document explains nothing about the Data Files folder.

You can create a folder in the project directory with any name, for example "mydata". It would be safe for you to locate your own files into this dedicated place.

Though I am not saying that introducing mydata folder will change something. All I’m am saying is no smell, the better.

1 Like

@grylion54 told enough. I have no more inputs.

getting some error with the prior inputs. If you can just have a look and advise.

I guess, your common.Excel class is something like this:

package mock

import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class ExcelIO {
	
	public void writeToExcel(String filePath, String sheetName, int rowNumber, int colNumber, String text) {
		try {
			FileInputStream fis = new FileInputStream(filePath)
			XSSFWorkbook wkbk = new XSSFWorkbook(fis)
			XSSFSheet sheet = wkbk.getSheet(sheetName)
			XSSFRow row = sheet.createRow(rowNumber)
			XSSFCell cell = row.createCell(colNumber)
			cell.setCellValue(text)
			println "cell($rowNumber,$colNumber)=${cell.getStringCellValue()}"
			fis.close()
			
			// save the Worksheet into .xlsx file
			
            //FileOutputStream fos = new FileOutputStream(filePath)
			//wkbk.write(fos)
			//fos.close()
			
		} catch (FileNotFoundException | IOException e) {
			e.printStackTrace()
		}
	}
}

Please find that the above code has 3 lines commented out — intentionally it skips saving the change into .xlsx file.

I think, you should ask yourself why the excel file is not updated with new data.

I guess, your common.Excel.write method forgot to save the change into .xlsx file.

If this is the case, everything should be figured out.

However,

you’ve found out a right path; you shouldn’t go back.

1 Like

Shout out to your awesome support @kazurayam. Really appreciate your effort.

1 Like

I can not help insisting to others: “Don’t use Excel”.

I really hate Excel.

Why? Because my current job is to write programs in the rubbish Visual Basic for Application in Excel. This job makes me crazy everyday.

2 Likes

Thanks @kazurayam for your advise.
I am happy with my Global Variable for now :smile:

1 Like

Hi there @dsingh1, :wave:

It is good to see that Kazurayam has been able to help you with your question. If possible, could you help us to mark one of their replies as a solution so that others who are having the same issues can resolve theirs quickly?

Follow the gif below to mark a comment as a solution :point_down:

Thanks,
Albert

Hi all, :wave:

We would like to share with you that this thread has been chosen by our internal teams to be turned into a blog post on the Katalon Blog, you can find the link below:

We have revised the thread to be more succinct but still go over the issues faced by the OP, alongside mentioned the proposed workaround by other members.

:pushpin: Note: These blog posts are not intended to offer readers a one-size-fits-all solution to their questions, as we are aware that different machine settings and configurations may lead to different results, but rather to facilitate peer-to-peer discussions and collaboration.


Mistakes and inaccuracies are bound to happen with these blog posts. Hence, we encourage you to share your thoughts and feedback in Site Feedback.