Is it possible when running an entire test suite to make it stop on an assert failure?
It currently stops running that failed test then continues to run the next test.
I want it just to stop and fail on the first failure.
Thanks
I found https://addons.mozilla.org/en-US/firefox/addon/power-debugger-selenium-ide/ which is a Selenium IDE plugin which adds a Pause on fail button to Selenium IDE.
In selenium ide we can add Pause on fail button by simple install one plugin in the selenium IDE. When pause on fail is turned on, Selenium IDE would pause the execution of the test case when there is an error is produced or a command failure
Install plugin from https://addons.mozilla.org/en-US/firefox/addon/power-debugger-selenium-ide/
don't know if you ever got this issue resolved but I use a plugin to cater for this issue.
The plugin is 'Selenium debugger' and I was able to download it from
https://addons.mozilla.org/en-US/firefox/addon/power-debugger-selenium-ide/
install using firefox. Then, once firefox has restarted, an additional icon will appear on the Selenium toolbar (pause on fail). Works a treat for me!
The only thing of note is that if the script fails on the last line of a test CASE it may still continue to the next test case in the suite. The way round this that I use is to add a 'pause 100' entry to the last line of each test case so that the plugin can 'hook' onto it.
I hope his helps
You could write the assert into if and on false stop the run.
Related
I have observed that whenever I run my automated script along with reporter, the test runs through successfully but the testcafe process does not end. After closing the application browser the testcafe run window never closes. This happens only when run command includes reporter details like
'testcafe chrome RegressionTestHappyFlows/calculatePremium_ShortTermTravelInsurance.ts --env=Test_English_ET --reporter html:TestRun.html'.
If I remove the reporter details from the command then the testcafe process ends properly as expected. I have tried with testcafe-reporter-html(version : 1.4.6) and also with multiple-cucumber-html-reporter(version : 1.18.0). In both cases I face the same issue. Testcafe version that I am using is 1.9.1
Could some one please help and suggest me a solution.
Thanks
I have about 130 Selenium UI tests for a web app we're currently developing.
The problem I have is, whenever I run the tests locally through Visual Studio's test explorer (vstest), I have never encountered this error before.
The problem is, some of the tests keep failing due to this message when the tests are run on TFS (using vstest on TFS too). element click intercepted
I'm also 100% sure there is no overlaying element that interferes with the click method as the tests never fail with that message when run locally.
Any idea what could this be?
I had issues where all of my local tests would pass, but I would receive random errors as you mentioned when running the tests through Jenkins or TFS, usually errors indicating that my elements were not clickable, etc. - the issue ended up being the browser size.
I started running my test in headless mode and specified a large browser size. Switching to --headless and setting a browser size ended up solving most of my issues for me:
var headlessOptions = new ChromeOptions();
headlessOptions.AddArgument("--headless");
headlessOptions.AddArguments("--disable-gpu");
headlessOptions.AddArguments("--window-size=1920,1200");
You will have to use --headless for this to work too. I tried to run my tests by ONLY setting window size, but the tests would still fail anyway because the resolution of the virtual machines was not large enough to handle the browser size I had set.
You can resolve this issue by using 2 methods.
1.Running chrome in headless mode
2.Scorlling to the element before clicking or interacting with it
The root cause of this issue is due to the fact that the browser does not load with a browser size as that of browser when tested locally
If you intend to run the test in non headless mode you can use the following code to achieve the result.
IWebElement element= driver.FindElement(By.Id(selector));
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", element);
is it possible to run selenium script in server without using eclipse or command prompt.for every fixed time intervals my selenium script has to run automatically in backend with out any browser opening
This can be split into two questions;
Can I schedule a Selenium test?
Yes, there are many options including using a CI tool such as Jenkins, Hudson, Team City,etc. Alternatively you could write a shell script to run the command line, and schedule this to run every x hours.
Can I run Selenium without opening a browser?
Yes. As mentioned before you could go headless, but depending on complexity of your application and test, you may find headless is not suitable. However, you can use RemoteWebdriver to launch a browser on a different machine but the test would still be run on your back end, it would just be the browse launched remotely. See https://code.google.com/p/selenium/wiki/Grid2 and https://code.google.com/p/selenium/wiki/RemoteWebDriverServer
I'd like to start Selenium as a Grunt task, run Cucumber, then stop Selenium after Cucumber exits.
I tried using grunt-shell to start Selenium. While this works, Selenium continues to run (as expected) and so Grunt hangs waiting for it to exit.
I also tried grunt-bgshell. This starts Selenium, but Grunt immediately starts Cucumber before Selenium is ready, and then Selenium continues to run after Grunt exits.
As a workaround for stopping Selenium I could probably use shell and curl to send the shutdown request to Selenium. But if there's a way to accomplish this without a workaround that would be even better.
Update
See my answer below:
David Souther has written the grunt-selenium-launcher plugin which does exactly what I needed.
However, even after using the grunt-selenium-launcher plugin, Julien Biezeman helped me discover the best way to solve my problem was to launch selenium directly from my end to end tests in Cucumber using selenium-launcher.
I hope this helps someone!
I have a problem with Selenium under Jenkins 1.446 together with Xvfb: It looks like firefox is started correctly because I let my failing tests record screenshots. These screenshots all show the same failing page, which in my case is the starting page where the tests should begin. So I gues the selenium WebDriver commands do not arrive. What could be the reason? By the way, the tests are running perfectly on my local machine.
I'm using Firefox 9.0.1 with no specific test profile and no AddOns, Ubuntu 10.04, Senlenium 2.16.1
Log entry: com.thoughtworks.selenium.SeleniumException: Timed out waiting for action to finish
Thanks!
EDIT: Issue seems to be fixed by a system reboot ...
I experienced a very similar issue with FF9.0.1 and Selenium 2.16.1 running through JUnit launched by Maven SureFire plugin run by Jenkins on a WinXP node.
2.17.0 fixed the issue for me. Try updating to the latest Selenium.
Through RDP, I was able to watch the tests running. The tests appeared to be partially blocked by a prompt from Firefox asking about collecting anonymous usage statistics. Manually answering the prompt would allow the test to continue but because Selenium creates a new profile each time by default, the prompt would return on the next browser launch. Running the tests locally with a pre-configured FF profile allowed me to persist that the prompt had been answered. This isn't possible on my XP node because the tests are running as 'System'.
Selenium/WebDriver would normally take care of this for you by marking the prompt as already answered in a temporary FF profile configuration but a bug was causing the value to be set to the wrong value. You can inject a profile configuration to the Selenium FirefoxDriver driver to pragmatically configure stuff like this prompt but the bug appeared to prevent this as well. This has been resolved in Selenium 2.17.0 (http://selenium.googlecode.com/svn/trunk/java/CHANGELOG see 2.17.0 WebDriver bug fixes).