Dynamic test case naming

Hi,
We use test cases as a representation of the user flow and excel data files to handle the varying input.
for a login test case we can use many different combinations that represent the specific “business” test case.
For that reason in the reports its very difficult to understand what tests fail because they all use the same “katalon test case” name but with different data.

Is there a way to change the test name dynamically according to the data it takes as input for each run in the test suit? or at least have a way to modify the reports generated in katalon?

Hi @daniel.andargie

There is currently no way to change the name of the Test Case at run-time.

Regarding changing the report, the Basic Report plugin is open-sourced. You can try to read the source code to figure a way to customize the report to your needs.

Additionally, sometimes ago I wrote a Sample Report Plugin showing how you can generate a simple report by writing a Custom Keyword Plugin.

I don’t know if the precise use case you’re asking for can be achieved this way, but by all means do try to figure out.

Hope that helps !

2 Likes

If all the combinations are saved in Excel, how about you add one or more extra columns?
Eg a column called ‘scenario’ has a brief summary. Or a column named ‘Test Case’ where each row has a unique TC number?
In the test case, get the value and do a println at the start of each iteration. This wouldn’t give you a new test case name but it could give you a summary within the test case. Just a thought

1 Like

Its a nice workaround, the thing is We want to see in the report the what cases failed exactly.
now we see:
test case login : pass
test case login : fail
test case login : pass
test case login : fail
test case login : pass

We need to click on each run to see exactly what scenario failed…

another solution is to create new test case for each scenario but I’m not sure its best practice to copy the same test case for each input…

2 Likes

Did you find an answer to this? We also like to have a unique name of Test case that runs per line of Excel in the Report.

Thanks,
Shamim

1 Like

@Dan_Bown - Did you ever figure out a solution for this?

Still using the solution I mentioned above, since it’s not possible to dynamically rename a test case.
So, something like this.
Spreadsheet used to store date:

TestCaseID	    | Scenario    			        	| Username   	| Password
------------------------------------------------------------------------------------
1		        | Test login with valid password	| Username	        | TopSecret
2		        | Test login with invalid password	| Username	        | wrongpass
3		        | Test login with forgotten password| Username	        | Yes

Then two variables in the script, for example (in addition to the ones you would need for username and password):

Name = TestCaseID
Type = Test Data Value
Default value = findTestData(yourData).getValue("TestCaseID", 1) -- returns your defined test case ID

Name = Scenario
Type = Test Data Value
Default value = findTestData(yourData).getValue("Scenario", 1) -- returns your scenario description

And then add steps in script to print the values above:
WebUI.comment(TestCaseID)
WebUI.comment(Scenario)

Map the data in a test suite. Assuming you have multiple rows, suite execution will run every row in your data fileand print the value for each row, eg a test case ID and a scenario description.
You won’t see this until you start looking at the report detail of course - it would be nice to be able to quickly identify each iteration in a report, but this seems like a reasonable workaround. Cheers

Thanks Dan. Interesting Katalon hasn’t created a solution that allows you to see at a higher level so you don’t have to dig into the test case details in order to determine specifics