Running automated tests in client machine - selenium

Basically my requirement is :
I have developed a framework using selenium webdriver,maven and testng for a application under test.
Now i have to pass that on to the client without sharing the source code ..so that if he wants he can run the test in his machine without having everything else installed ..except java. and the output should be stored in one of the specific folders of the client machine.
Can i use any plugin in maven which will store the result or copy the result file to any folder of client machine.?
Please guide me how to achieve this.. how to pass on the above to client so that test run smoothly in his machine .
is there anything i need to take care while am using maven in the project?
I am using chrome browser to run the tests..
The application under test is available to be accessed from any type of browser.
kindly suggest.

Related

Run Selenium tests against a .NET Core web app

I have a .NET Core web app that connects to a .NET Core API and I want to run Selenium UI tests against it. However, the Webdriver can only connect to the web app if I first run the web app and API in IISExpress. What's the best way to run them without having to explicitly start them in IIS? I've tried to create a new Process to use 'dotnet' to run the web app (and API) for me but it won't run. Has anyone had a similar problem?
You'll first want to figure out how to get your application running before trying to test it with Selenium. This post might help you with that. After you figure that part out, you'll want your web application with its server running before you run your Selenium tests against it. This can be accomplished in a number of ways:
Get your server hosted non-locally
Manually starting your server locally and running it prior to running the test
Have your test application build and run your server with a Process instance
If you decide to go with the third option, you'll of course need to find out how to properly get your server running. In my experience, the dotnet build and dotnet run commands usually do the trick. The dotnet build command takes in a SLN or CSPROJ file, then compiles your server's source files and outputs a DLL. You can then specify this DLL in the dotnet run <DLL> command.

Run automated tests on AWS device farm in incremented ways

I am evaluating AWS device farm for running mobile web test. These are the steps I am anticipating:
Create sample tests (Java)
Package that as zip file
Go through the AWS device farm console and upload the test zip only
Manually select the configuration and other things
Manually execute the test and evaluate results
For thing I need help are:
a) What if the tests needs some changes, do I need to go through the JAR package creation for every run? Can I run test from my IDE and if everything works fine then only package and upload it on AWS device farm?
b) To do (a) I noticed they have API to simulate step 3-5 to achieve running tests but wondering if there is some easy way to do it?
The steps you've listed are the correct sequence of tasks that need to be performed to run tests on a device. With AWS Device Farm, you have to perform the extra step of uploading the tests and application to the service. As you stated, every time you change your tests, you will need to rebuild the JAR and upload it. Most customers set up a continuous build/integration pipeline using a tool like Jenkins to perform this task automatically.
If you are running in Android Studio, you can use the Device Farm Gradle plugin, which will do the work for you.

How to get selenium server running locally?

I need to have selenium server running in order to run some tests I'm creating in http://seleniumbuilder.github.io/se-builder/
This is not for the selniumIDE and not for a server grid, I need to be able to export from selenium builder and am directed to run them on a local selenium server, e.g. localhost:4444
I use the download page at http://www.seleniumhq.org/download/ but there isn't much info on basic stuff.
I see the link for the download and I can save the .jar file Now what? I don't know Java. Trying to click thru gets
[
[
How should I be compiling and then using it?
Selenium means different things depending on context.
Do you want to record/playback simple web browser interactions? You want SeleniumIDE or Selenium Builder. You need a standalone jar when replaying the tests from the command line; I think the docs tell you how but I couldn't find it. This small blog post tells you how. Essentially: download the Selenium Standalone Server jar file from SeleniumHQ and run it something like this:
java -jar c:\selenium\selenium-server-standalone-2.21.0.jar -htmlSuite "*firefox" "http://localhost:8080" "c:\test\my-test-suite.html" "c:\test\my-test-result.html"
(Note: even though it is called a "server", in this mode it does not listen on a port for incoming requests or anything like that; to most people's way of thinking, the jar file is actually a client in this mode, and the browser that it connects to is the server! The jar file does include a server, you're just not using it when executing a Selenese file like this.)
Do you want to run tests locally from your unit test runner (JUnit, NUnit, etc.?). You probably don't need a server. All the instructions are on this doc page.
Do you want to run the tests via a grid of multiple browsers, allowing you to distribute the load and do multi-browser testing easily? This is where Selenium server shines. Everything you need to know is on this doc page.

Run automated test cases on local machine's web browser - HUDSON

I use remote hudson server for test automation of webapplication. When I run the automated test cases they ran on the browser of that remote machine. I rather want them to run on my machine.
Is there a way I can achieve this.
Regards
You can run Jenkins slave on your machine and tie the job to it (there is such an option on the job definition page). Moreover, you can use NodeLabel Parameter plugin and use a parameter to specify to which node you want to tie your job. For example: by default it will run on Master, but you also can specify your slave when running it manually.
You don't say what tool you're using to drive the browser. If you're using selenium, you can set up a selenium server on your machine, then direct your tests to use your machine.
Considering you are talking about a test browser , I assume you use the selenium plugin for hudson/jenkins. you can change the location/capabilities of the node where the test are run against in your testcode.
capabilities.setBrowserName("firefox");
capabilities.setPlatform(org.openqa.selenium.Platform.WINDOWS);
also it's possible to exclude the master from the node list by editing the config file in the jenkins plugin folder
If you are refering to just restricting where the project can be run, this can be found
https://[jenkins name]/job/[jobname]/configure
under Restrict where this project can be run

Using selenium grid to execute remote code

We looking to use Selenium grid to parallelize our tests but some of our tests need to run java code local to the testing machine. In other words as well as automating the browser we also need to run some java code on the test machine. Are there hooks in Selenium Grid that will allow us to do this?
PS we are also looking at Jenkins to setup our environment.
EDIT: To be clearer, the java code I need to execute does a get from the web application, downloading pdf files that we cannot do with selenium alone. It then does some processing on those PDF files. I suppose the processing could be done on the server hub but the downloading can't. Unless someone can explain how to download a pdf using selenium and save it to a given location?
Selenium cannot execute your java code in the remote control machine. It will get executed only in the hub machine. However, taking screenshot, deal with popup, uploading the files in a specific path can be taken care by Grid.