I've been testing in Selenium IDE. It's pretty easy to use, and I have created some test cases with it. I've been searching Google, trying to find a way to repeat my tests automatically. I've seen a solution with gotolabel, while loops, etc. But I couldn't make any of them works. Can someone give me a tip on how to loop my test n
times, or loop forever. I appreciate any help.
相关问题
- Get access to Angular service instance from JavaSc
- Port of the Rails app when running Cucumber tests
- Selenium View Mouse/Pointer
- What is a correct approach to manage test data usi
- How do I pass variable data between tests
相关文章
- Web Test recorder does not allow me to record a te
- Factory_girl has_one relation with validates_prese
- What is the difference between `assert_frame_equal
- How do I send cookies with request when testing Fl
- Unit test Angular 2 service subject
- Unit/Integration testing FTP access
- How to set a test for multiple fetches with Promis
- How Do I Seed My Database in the setupBeforeClass
Do this:
The js file provides goto, gotoIf and while loop functionality in Selenium IDE. The example below shows a simple loop:
Your test suite file is just an HTML file, so just do the following:
I found this tutorial to be much more helpful, because some of the above responses are simply "go to" solutions, instead of iterative looping constructs:
http://www.software-testing-tutorials-automation.com/2013/07/example-of-while-and-endwhile-loop.html
I'm new to Selenium (just started using it a few minutes ago). After a quick Google search for "selenium loop" this stackoverflow.com question came up. I immediately jumped into the extension and started using loops. The accepted answer is very helpful. However, I wanted to point out something else for others that are new to selenium (and stumble on this page).
I created a simple test for a simple web page. I added a loop so that the test would run indefinitely (until I paused/stopped it). However, I noticed that by doing this, the Runs/Failures counters within the Selenium GUI do not increment with each loop (I am guessing because a single test case was never running to completion, it was just looping indefinitely). So I dug a bit further. My goal was to leave the same test running for a long time (a few hours, or possibly overnight) to see if there were any failures (I'm chasing an intermittent bug at the moment).
The simplest way (for me, after a few minutes of searching/experimenting) was to do the following (likely no plugins needed, although the attached plugin is definitely helpful if you want to run a few small loops within a test case):
Now I have the same simple test suite running many times, and the Runs/Failures counters are incrementing as expected (without the need for any loops).
This is a sample for sampcop user in order to automate spam complaints using label and goto Label commands:
1st Login on spamcop.net
2nd use Report Spam option
3rd start this script
Use the Flow Control plug-in for Firefox. After restarting Firefox, use the
label
command to mark a point in the script, and thegotolabel
command to jump there.For example:
Or if you'd rather see the source code, this is a label:
And this causes the execution point to jump back to the label:
There are other commands that you can see on the plug-in page, and documented in the Selenium IDE: Flow Control GitHub project.