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

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.

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,

How to run Selenium script recorded in Firefox plugin with console output?

We have a requirement to run selenium script recorded in fire fox plugin via tool which can run these scripts and give logs on a web console. Does anyone know of such a tool?
Requirement is that QA guy records a bunch of test cases and then some non tech person can simply come in and run these and see verbose output.
Have a look at the following plugin for Selenium-IDE to save log to a file.
https://addons.mozilla.org/nl/firefox/addon/file-logging-selenium-ide/
if you are looking for record playback too, this would be a better option.
https://addons.mozilla.org/en-US/firefox/addon/imacros-for-firefox/
They have plugin for chrome as well, so hopefully you can use run the same recorded scripts in chrome browser as well.

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.

Is there any automation code that always works perfectly without exceptions

I am new to test automation (Selenium WebDriver) and I have created a good automation code, that sometimes runs perfectly, but most of times it just fails, without any good reason, with no code changes.
Is this normal or the problem is my code?
I just want to know if anybody faced that problem before or it's just me.
Tests that rely on external systems are often a better fit as integration tests, and Selenium tests definitely belong in that category. If you are using Maven, you can run the Selenium tests using the Failsafe plugin instead of Surefire. This allows them to "fail" without breaking the build, but you can still have ordinary unit tests that must succeed.
With reference to https://sqa.stackexchange.com/questions/9007/how-to-handle-time-out-receiving-message-from-the-renderer-in-chrome-driver , following are recommendations :
Solution 1: There are some plugins like flash player which may hangs the browser inconsistently waiting for some resource during test run, try disabling such plugins while starting the test using the chrome switches. http://peter.sh/experiments/chromium-command-line-switches/
Solution 2: The browser might hang waiting for some third party ads. Try disabling ads using some ad blocker extension or block the url pattern using the custom proxy configuration.
For inconsistent browser hangs, Try to find which process hangs the browser. 1.Unlike firefox chrome creates separate process for browser, tab, extension and plugins. 2.When the browser hangs check is there any new process(shift+Esc) like Web Worker:blob appended with an third party url, then follow #2 3.or else if there are more separate process opened for plugins try #1
Please refer to below link :
https://sqa.stackexchange.com/questions/9007/how-to-handle-time-out-receiving-message-from-the-renderer-in-chrome-driver

steps to automate a flex application using flex monkey and selenium

Am trying to automate a sample Flex application using Flex Monkium and selenium.
The steps and sample application (MonkeyContacts) are given in gorilla logic site http://www.gorillalogic.com/testing-tools/flexmonkium/flexmonkium-docs/using-flexmonkium .
After following the steps in the above application i am able to record the tests using Selenium IDE and able to run those tests using Eclipse and TestNG.
But when am trying to do the same steps in other applications ( http://learn.adobe.com/wiki/display/Flex/Download+Projects ) , not able to record the tests. There is no interaction between Flex Monkey and Selenium. I have added the automation-monkey.swc and added the Additional compiler arguments also.
How to make the application to interact with selenium..?
Thanks in Advance.
Gorilla logic has beautify stated all related steps for flex monkey automation, I'll say you give it a look again. Flex monkey documentation
Apart from this always make sure
Flex monkium console icon turns green (if not its NOT compiled properly, check compiler arguments.
Use firefox version 10 or less. Selenium is not compatible with later versions.

Categories