How can I run my test case on URL#1, then on URL#2, then on URL#3, and so on

My data is in users.csv which has only one column: a list of URLs (URL#1, URL#2, URL#3, and so on.)

URLForEachUser is the name of the one column in users.csv.

As you probably surmised, I want to run my test case on URL#1, then on URL#2, then on URL#3, and so on.

Test Case #1 fails completely

Test Case #1 is…

storeCsv | users.csv, 0, URLForEachUser
URLForEachUser
open | ${URLForEachUser}

Test Case #2 does not work properly

Test Case #2 opens URL#1, URL#2, URL#3 and so on from users.csv. However, it opens each URL immediately in succession. In other words, it opens one URL right after the other URL. In other words, it does not open URL#1 and then run the rest of my test case, and then open load URL#2 and then run the rest of my test case, and so on.

loadVars | users.csv 
open | ${URLForEachUser}
endLoadVars

I have spent hours combing this forum and the web. The following look helpful…

  1. The "loadVars" runs for an extra csv row that doesn't exist (This looks promising, but I was unable to figure out how to apply it to my test case)
  2. Please help on Katalon Recorder Data-Driven using CSV
  3. How to use storeCsv command
  4. Question about StoreCsv command
  5. Data Driven Katalon Recorder

I will be offline for the approximately the next 30 hours, therefore, please don’t expect a response from me sooner than then.

I think I solved my problem.

The following test case will open URL#1, then it will open URL#2, and finally it will open URL#3.

The “0” (zero) in users.csv,0,URLForEachUser corresponds to row #2 (the second row) in users.csv. In other words, Katalon considers row #2 to be line zero. Obviously, that can be a little confusing but now you should not be confused.

The “1” in users.csv,1,URLForEachUser corresponds to row #3 (the third row) in users.csv.

The “2” in users.csv,2,URLForEachUser corresponds to row #4 (the fourth row) in users.csv.

Put simply…

Katalon 0 = row 2 in your .csv file
Katalon 1 = row 3 in your .csv file
Katalon 2 = row 4 in your .csv file

My solution above is based on the following comment by @Piotr

Thank you Pitor!

I’m really glad it helped You :slight_smile:.

About this:

loadVars | users.csv
open | ${URLForEachUser}
endLoadVars

From what i know it’s basiclly a loop wich start at “loadVars” and end on “endLoadVars”, so it’s should look like this:

loadVars | users.csv
open | ${URLForEachUser}
<fill form/submit and do everything you need to do on the page>
endLoadVars

So “endLoadVars” should be at the end of file.

This solution however have some big disadvantage: if something goes wrong on first loop it will stop and won’t check others URLs. For me it was a problem so i create one testsuite and make copy of file, rename it and change URL at the beginnig of file in open command.

I apologize for this loooooong reply.

I’m really glad it helped You :slight_smile:.

I’m glad you’re glad :slight_smile:

About this:

loadVars | users.csv
open | ${URLForEachUser}
endLoadVars

From what i know it’s basiclly a loop wich start at “loadVars” and end on “endLoadVars”, so it’s should look like this:

loadVars | users.csv
open | ${URLForEachUser}
<fill form/submit and do everything you need to do on the page>
endLoadVars

As you might have surmised, I’m not a technical person. I’m essentially a business guy who reluctantly occasionally wrestles with simple technical problems out of necessity. Therefore, I need to translate technical jargon into something resembling plain English. Is the following correct?

  1. Katalon Recorder will attempt load users.csv which has a list of URLs such as URL#1, URL#2, URL#3, and so on.
  2. If successful with proceeding step then Katalon Recorder will open URL#1.
  3. If successful with proceeding step then Katalon Recorder will “make breakfast” for URL#1. By make breakfast, I mean Katalon Recorder will follow my instructions such as: open the refrigerator, take out the butter and cheese, place them on the counter, drop the cheese on the floor, shout an expletive, watch the dog come and begin eating the cheese, yell “bad dog!” at the dog (who feigns deafness as he continues eating the cheese), and so on. Well. Ok. Sure. Maybe those aren’t actually my instructions to Katalon Recorder… but I am getting hungry!
  4. If successful with proceeding step then when Katalon Recorder finishes making breakfast for URL#1, then Katalon Recorder will attempt to make breakfast for URL#2.
  5. If successful with proceeding step then when Katalon Recorder finishes making breakfast for URL#2, then Katalon Recorder will attempt to make breakfast for URL#3.
  6. And so on until Katalon Recorder has either been unsuccessful with a step or Katalon Recorder has made breakfast for all of the URLs in users.txt. Right?
  7. Then Katalon Recorder will take a nap because she will be disappointed because she did not get much done due to an early failure and/or she will be exhausted from all of the work she has done (including yelling at the cheese-loving dog… who was not really deaf)!

So “endLoadVars” should be at the end of file.

Does endLoadVars mean TakeNap when using my facetious anthropomorphism of Katalon Recorder?

This solution however have some big disadvantage: if something goes wrong on first loop it will stop and won’t check others URLs. For me it was a problem…

I already experienced the disadvantage you mentioned with my script above named, “Opening a list of URLs sequentially.” Katalon Recorder had a problem with one of my URLs. Let’s say Katalon Recorder did not find any cheese in the refrigerator for one of my records. Immediately thereafter Katalon Recorder took a nap (failed to run the test case on any of the subsequent records)! I reprimanded her, ran the test case again, yet Katalon Recorder ignored me and took a nap… once again! I threatened to fire Katalon Recorder but she simply ignored me. Ok, let me put aside my facetious anthropomorphism… at least for now.

Seriously, that was a problem for me. And seriously, I am glad to read that you have solved the problem (with a seemingly simple yet elegant workaround).

Frankly, that problem seemed utterly ridiculous to me. How often would a user actually want Katalon Recorder to behave (work) that way? I guesstimate (which, of course, is a portmanteau of guess + estimate) a user would want that behavior less than 5% of the time.

Imagine you had entered a supermarket with a list of, say, 25 items. Imagine you had put the first 6 items in your shopping cart (in American English we say, “shopping cart” whereas in British English they say “trolley” which sounds really weird to me) but then were unable to find the seventh item. Would you go home with only the 6 items or would you try to find and purchase the remaining 13 items on your list?

I’m always amazed that software companies employ product managers who, well, don’t seem to comprehend how to properly create good—let alone excellent—functional specifications. Bad functional specifications are a common bane in software companies.

Obviously when performing a test for a list of records (I’m referring to record in the way it is used in database terminology) the default behavior should be that when a test case cannot run on a particular record in the list, then the test case should skip that record and continue on to the subsequent record the list. Obviously, the error (or the errors) would noted in the log file. For what I have surmised would be uncommon cases when a user actually would want the current inane default behavior, a user could add a command like EndImmediatelyOnAnyError or, to use my lexicon TakeANapImmediatelyIfSomethingGoesWrong.

so i create one testsuite and make copy of file, rename it and change URL at the beginnig of file in open command.

I am confused.

I think I understand that you created a workaround. That is, you seem to have circumvented the problem of the supermarket shopper immediately terminating his shopping trip by only purchasing the 6 items in his shopping cart, if item #7 were unavailable in the supermarket. Right?

Now I am guessing.

Perhaps instead of creating a test suite with one test case, perhaps you created a test suite with two test cases: the wife and the husband. In doing so, if the husband failed to find a particular item on the shopping list his wife had given him, he would continue shopping (continue trying to find all of the items on the shopping list his wife had given him).

For example, if the husband were to fail to find item #7 in the supermarket, then the husband would continue shopping (would attempt to find items #8 through #25 in the supermarket). Is that correct?

If you don’t mind, I would appreciate it if you would send me a couple/few of screenshots of the relevant test suites you created.

By the way, I use Flameshot for taking screenshots. I like it very much. Because I’ve been running Manjaro XFCE for the past six months or so (I wanted a rolling release therefore I switched from a distro named GalliumOS which is based on Debian/Ubuntu in favor of Manjaro which a distro based on Arch Linux) I install Flameshot with Pamac which is a simple GUI for installing software applications. Regular Arch Linux is too difficult and too “techie” for me.

Again, I apologize for this long reply. Thanks for reading it.

One of many pages i have to tests is basiclly kind of one page. Most of the code is the same but they are for diffrent countries so they have some diffrences too. Bascily i could use one test case for every one of them with some addional if statements. Unfortunately code was too big so execution took to much time.

There is a problem with if in katalon. Using Your shopping analogy:
You tell him to go to shop1 and buy apples, then under certain condiotion go to shop2 and buy juice then go to shop3 and buy a carrot.

What Katalon will do is: go to shop1 and buy apple, check the condition and even if it’s false it will go to shop2 look at juice a then go to shop3 for carrot.
So it’s work ok but it can look like an issue. If You then start this test again (without closing Katalon or reloading test case) it will work just fine and skip some of the commands based on condition.

So, no matter how quick it could take, it will go through all of the commands wich was waaaaay to long for me.

One of many pages i have to tests is basiclly kind of one page. Most of the code is the same but they are for diffrent countries so they have some diffrences too.

If I understand you correctly you are saying that the pages you are testing (in, for example, English, French, German, Ukrainian, and Russian) are, more or less, 95% the same. Right?

Bascily i could use one test case for every one of them with some addional if statements.

That makes sense.

Unfortunately code was too big so execution took to much time.

I see.

There is a problem with if in katalon. Using Your shopping analogy:
You tell him to go to shop1 and buy apples, then under certain condiotion go to shop2 and buy juice then go to shop3 and buy a carrot.

If-then and if-then-else statements are fundamental components of computer programming.

What Katalon will do is: go to shop1 and buy apple, check the condition and even if it’s false it will go to shop2 look at juice a then go to shop3 for carrot.

Even if it’s false? That is not good.

So it’s work ok but it can look like an issue. If You then start this test again (without closing Katalon or reloading test case) it will work just fine and skip some of the commands based on condition.

This sounds like a logic glitch not a programming bug.

So, no matter how quick it could take, it will go through all of the commands wich was waaaaay to long for me.

This sounds like problem that a Katalon developer could fix without too much difficulty. Have you submitted feature request or bug report to Katalon about this?

By the way, the following is essentially off-topic, albeit tangentially related to our discussion, but I found it interesting therefore I though perhaps you might too… An Overview of JavaScript Testing in 2020