Manish_soni avatar image
Manish_soni asked Manish_soni posted

Testcase pass /fail

Hi all ,

 Can we pass our testcase ,without putting and assert rule?and one more thing is that can we make device name dynamic during definig our testbed?


10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

JeffJ avatar image
JeffJ answered JeffJ posted

Test cases are indeterminate until at least one analysis is performed.  I would think making a test case default to pass would be misleading as you would not know if any analysis was actually performed or not.


However, if you wanted to do this, there is a Global Event called OnProcedureOpen that is executed at the start of any procedure.  By default, there is are no rules executed for this event.  You could create a "PassTestIfNotAlreadyFailed" rule that would set the status to Pass on initial entry into the procedure.  Be careful to use "PassTestIfNotAlreadyFailed" as this Global Event will get called for every procedure in your test case.  If you use "PassTest" you could overwrite a "Failed" status and artificially pass a failed test.


On the question of dynamic device naming in the test bed, the answer is no.  The idea behind this name is it is generic so that you can switch testbeds without having to edit your test case to change the device name in the test case. 


Having said that, I'd be curious as to why you would want to change the name.  There may be another method to achieving your goal that is more portable and maintainable.

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KumarS avatar image KumarS commented ·

You can pass a test by either adding an analysis rule or by overriding events as Jeff mentions. But I think analysis rules in your testcase are preferred because other person reading your testcase can very clearly see that you as an author have made a conscious choice to make the test pass.


comment    "this step passes the test"

           analysis rule:

                  extractor: none  <-- choose none extractor as it will extract nothing from the response

                 assert:   1 == 1

                          when true


                          when false

                                     do nothing




0 Likes 0 ·
KumarS avatar image KumarS KumarS commented ·

Regarding device names - device names in the testbed cannot be dynamic. It seems like you have the need to connect to different physical devices. The way iTest is optimized for it is to create different testbeds.


For example, if I have a testbed with a RouterA, RouterB and SpirentTrafficGenerator and I have set all the properties properly for each one of these devices, if I want to run my testcase against another testbed with the same pattern, I would create another testbed and make it based upon my previous one and simply change the IP addresses. Since the device names are same in the two testbeds, I can run my testcase against either of these testbeds and testcase will run appropriately on the testbed which I ran the testcase against.


Of course, you can have only one testbed and parameterize the IP address and other properties or not have a testbed at all and simply parameterize things in the testcase, but these will require you to understand more advanced methodologies of using testbeds. If you search on the forum for these cases, you will see that others have posted a lot of messages on how to do that.


But my recommendation always is to create new testbed files.

0 Likes 0 ·
Manish_soni avatar image Manish_soni commented ·

Thanks for replying me Jeff. But i  am not able to find that Global Event in iTest 3.4. is it same as OnProcedureEnter. i am getting these two event OnProcedureEvent and OnProcedureExit, both is having no rules.





0 Likes 0 ·
AmishP avatar image AmishP Manish_soni commented ·



You are right, its "OnProcedureEnter" and "OnProcedureExit".


You can uncheck the "Inherit" check box and click on the "+" button to add an action. Default is "DeclareExecutionIssue". You can change it to "PassTestIfNotAlreadyFailed".


As Jeff mentioned,  be careful when using such global events.



0 Likes 0 ·
KumarS avatar image KumarS AmishP commented ·

I still recommend that you do not use "global" event OnProcedureEnter for this if you have more than one procedure. Your testcase will be much more readable if you follow my advice.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.