Stuck to run Selenium RC script simultaneously in multiple browsers - java

I am working in selenium RC with Java+Junit+Eclipse.
For my project I have developed script which will run in only one browser i.e Firefox through the below code..
public void setUp() throws Exception
{
selenium = new DefaultSelenium("localhost", 4444,"*firefox","http://www.google.com");
FinalTestSuite.selenium.start();
selenium.windowFocus();
selenium.windowMaximize();
}
Now I am stuck because requirement came to run the script simultaneously in multiple browsers.
I didn't find any helpful article..
Please anyone working on this same scenario...HELP! :)

You can use Selenium Grid to run a script in multiple browsers. Also you can refer this blog regarding its setup configuration.
Hope this helps.

Create a runner which will run the suite containing setUp()
Pass the browser name by variable to setup.
You can run the code multiple times with multiple RC server started on different ports.
e.g. My projects runs through ant so i pass -Dargument=*firefox on command prompt then my test cases run on firefox browser also you can pass the port number and host ip.
Thanks

The best thing to use for parallel execution is TestNG. But since you are using Junit , the following link may help you in that.
http://blog.varunin.com/2011/07/running-selenium-tests-on-different.html

Related

Having difficulty using SoapUITestCaseRunner in Selenium

Let's get straight to the point:
I'm from QTP/UFT background. My company is transitioning from UFT to Selenium.
We've got Ready API couple of months ago and now I have couple of test cases in ready api. When we run the entire regression suite, we'll have to run the soapui testcases as well as part of the regression suite and then continue the rest of the suite. So, technically this is the flow: run some test against web - then soapui tests - then continue with web and complete the regression test suite in Selenium.
I was trying to put pieces together here. I was trying to execute one of the testcases from soapui using SoapUITestCaseRunner class in selenium.
When I use Launch testRunner in soapui it works perfectly but when I try it in selenium I'm getting an error. See the screenshots.
I've provided two screenshots. One of them will show you the Failure Trace.
Another one will show the console.
I want to know couple of things:
1. Could you help figure out what's happening?
2. Is there a way to automate cmd through selenium so I can execute cmd codes?
3. can I somehow run the .bat file through selenium?
I had to download soapui-1.7.1.jar to get the SoapUITestCaseRunner. For some reason it wasn't available when I'd added all soapui jar files as external.
thanks,

Automation Testing without opening browser or any UI

I have been doing automation testing and it is working fine. It is working like open a browser, interact with elements and execute test cases based on given conditions.
I am using Selenium Webdriver, TestNG, Java and Maven for this.
Now from seniorI got request that we perform same test cases without open browser or interact with UI. How it is possible in selenium webdriver?
They said they will provide me API, It is possible to do same using API. If yes then kindly provide a small example so that I can know more about it and will implement then.
I have tried PhantomJS, HtmlUnitDriver but all have their disadvantage. I think Xvfv is the better solution, no need to change code just run your script heedlessly.
Install Xvfb
sudo apt-get install xvfb
And use this command to run mvn script heedlessly
xvfb-run --server-args="-screen 0, 1624x1068x24" mvn test
I hope it will help you.

Using the same Firefox Window to run multiple tests in Selenium WebDriver (Java)

I am running test cases on selenium Webdriver in Java. The first test case opens the browser window and performs the test.
After the first test case is complete I want to utilize the same browser window to run the next set of multiple test cases.
How can this be achieved? Can someone point me in right direction?
Don't quit your browser in the "TearDown" part.
Navigate to a common URL in the "TearDown" part from where multiple test cases can start.
Thus you will be able to utilize the same browser window to run the next set of multiple test cases.
You can reuse a browser in multiple tests using Spring to inject it. This can be faster for running a suite. But, and it's a big but, if one tests "dirties" the browser (e.g. with cookies), then you could easily find yourself spending more time debugging flaky tests that you save on run time.
There's an example here: http://www.alexecollins.com/tutorial-integration-testing-selenium-part-1/

How to run Selenium tests with single click or single command?

I'm writing Selenium tests using Java + Maven + Selenium WebDriver. Our customer wants these tests in such a way that they can run tests easily without much technical stuff needed.
I've all my tests under src\test\java folder. Is there any way where I can give jar file or so to the customer and they can run tests by simply clicking on it or by hitting some command on the command line.
Please point me to documentation or video using which I can achieve this.
I've been using Visual Studio to write my Selenium tests in C#. I am able to build my project to a console application in Visual Studio that contains the required files like the Chrome webdriver. It can be run from this single application file with one click. The console then prints out if the test is a success or if their are any exceptions. You should also be able to integrate a headless browser like selenium has on their site. This would allow the test to be run with one click and no browser will pop up while the tests are running.This is all the experience I have and it has worked well for me. Hope that this information can help a little.

How to run a test case without opening the browser window?

I have created a set of test cases using Firefox Driver in Eclipse IDE.
But now I need these test cases to run without opening the browser window. How can I achieve that?
Presently I am using Firefox Driver Web Driver that runs in Firefox Browser.
Can some one help me with an example?
If you do not need to think about compatibility of different web browser, you could try Celerity. It could be run automated test script without any browser window.
http://celerity.rubyforge.org/
It is based on JRuby, and is very easy to learn and use.

Categories