Ask a Question

Data Driven Loop doesn't returns to the beginning of the test.

Iso_Yura
Contributor

Data Driven Loop doesn't returns to the beginning of the test.

Hello, 

 

I can't figure out why my test doesn't start new iteration from the beginning of the test. 

I'm using csv file where I have a parameter. I expect that If statement checks the project name then depends on the name it runs one of the tests: QMZ or QHZ. But it doesn't do that way, all it does is run test then it meets first condition and run QMZ and then it starts running next keyword test QHZ instead of starting the iteration from the beginning. I marked by arrows how it should run.

 

What's wrong that it doesn't start again test from Data Driven Loop?

 

ddl.png

5 REPLIES 5
Marsha_R
Champion Level 2

In your diagram, you need to take everything included under your green arrow and indent it right. Then it will be included in the Data Driven Loop.

 

You can tell what's in the loop by looking at the faint line that goes down the left. Anything you want in the loop can't be on the same level as the loop.

 

 

It's already in the loop. I selected everything and tried move it to the right but it doesn't let me do it.

ddl-1.png

I would try the two If Then sections like this instead

 

If ... Then

Else

     If... Then

 

If that doesn't work, then put some debug statements before and after each step of the two IF statements to make sure that the variables you are testing on actually contain the values you expect. You may be accidentally comparing string to number or have some other mismatch.

 

Not it works, but not how I need to.

I have DDL  test:

    step 1

    step 2

    step 3

    step 4

    If...Then

        run test A

    Else 

        run test B

 

Now it executes all 4 steps, then it gets to If statement, which is True, then it runs test A.

After that it runs again 4 DDL steps(that's what I need) but then it runs again test A.

 

It shouldn't run test A, as condition is False now. It should run test B.

My test creates a new project, where project name is a variable stored in csv file, this is what my data driven loop does, each line in csv file is a project name. 

After I created first project A, it should run DDL test  where it reads project name from csv file, then I store project name into a variable X, then it gets to the condition where I check if variable X is == project name, in instance if X==new project1 then run test A, if X==new project2 then run test B. 

Every time when it runs through DDL steps it takes a project name as "new project1", "new project2", "new project3" and "new project4". It stores it into variable X, then it compares if X==new project1, and so on. 

In my If statement condition I have If X == "variable from DB Table", I'm expecting that it compares X with value in DB Table, this is new project1, new project2, basically those values are the same as I use for data driven loop(DDL).

So then you need to check your variable values at each step and make sure they are updating as you expect. You can use the Watch List

https://support.smartbear.com/testcomplete/docs/testing-with/debugging/panels/watch-list/about.html

 

and then Debug and step through the code.

cancel
Showing results for 
Search instead for 
Did you mean: