What is the use of jenkins with Selenium WebDriver? - testing

What is the use of selenium webdriver with jenkins?
Is it ok to integrate jenkins in webdriver even if we are not using jenkins in project integration.
I directly get URL of website to automate, Is jenkins help anything me in webdriver?

Jenkins is a job scheduler. You can use jenkins to configure your tests to run on a schedule (eg: every hour, every day at noon, etc), or every time you check in code. Jenkins also has features to allow you to run jobs on multiple machines, set dependencies between jobs, and many other features.
WebDriver is a library for writing tests that exercise websites using a browser.
You can use jenkins to run your WebDriver-based tests if you want your tests to run automatically. If you run your tests by hand, jenkins doesn't help you at all.

Jenkins won't help you anything in automating Applications. Its continues integration tools which helps in running bunch of automated test case by scheduling different jobs.

WebDriver is an web automation API that helps to mimic user navigation.
Lets say you want to test search in google. You can use WebDriver to write a code which performs the below
Launch a google page
Identify search box on it and enter text into it
Click on search button
WebDriver driver = new FireFoxDriver();
driver.get("www.google.com");
driver.findElement(By.id("gbqfq").sendKeys("Selenium");
driver.findElement(By.id("gbqfb").click();
Once you have written above code, you may want to run it everyday, or every 5 hours. Instead of you going and manually running it. You can use Jenkins to schedule execution of your scripts as a maven build(pom.xml).
Also you can configure to run your functional test cases through Jenkins automatically after code is deployed and build successfully.

Related

Can I create a test server for testing team with Selenium?

I made a Selenium code by Java to test a certain web-application that our company developed.
Now, developers fix the application quite often and every time they update or fix, testers should test this new version of webapp to assert all functions working fine before application release.
Let's suppose that there are 100 testers who do not know how to run Selenium code or install Java.
I decide to create a testing server so that testers can access this server and run test. They also can see all test histories and details so far as well.
Is it possible and realistic to develop a system that runs like server and client? If yes, Can Jenkins do that? Other solutions are welcome!
Thank you in advance and happy new year!
Jenkins is one of the tools, you able to use for this, since it provides a simple way to delegate some tasks to already configured envs, nodes share them for multiple users and hide technical complexity. Also this would be aligned to your CI process, e.g. first - deploy the new code to test env, next - run test automation.
But the same also might be said for some other CI tools, so I suggest to pick some CI tool which your development already uses.
The architecture could be:
1 CI task for run tests -->
2 CI Node or docker image with java, selenium,
maven(gradle), it may be some headless Linux -->
3 Selenium cluster which able to launch multiple
selenium sessions (to cover your testers needs). It could
be some selenium cloud service, or configured
onpremise env. -->
4 Selenium grid hub (may be headless)-->
5 Selenium grid nodes... The final nodes env
should match your test requirements. It could
be Docker with linux (headless or not) or
Windows/MacOs.
Pick some tools and look for quick start guides/tutorials.
Start from simple implementation and improve it continuously.
I may say that for many cases Docker + Ubuntu + Headless Chrome is fine, lightweight and rapid.
Some references (examples the tools I've used):
Jenkins + Selenium + Maven https://www.lambdatest.com/blog/selenium-maven-jenkins-integration/
Selenoid (selenium grid implementation based on docker containers) https://github.com/aerokube/selenoid
Report Portal (just reporting tool) - something more than the default testng report provides. https://reportportal.io/
This is very shortly. The same might be done with a lot of other tools.

Can we execute/trigger selenium automation scripts through UFT

Using Webdriver, I have automated web based Application in eclipse and using QTP, I have automated Power Builder application(like desktop App).
Now both become depended module for me, from PB data's are flowing to web base application.
so, how can I achieve this. please someone provide me how to proceed with situation and give me some strategy to proceed
We have exactly the same situation where powerbuilder application is integrating with the web application, below is the solution we have followed
We are using jenkins for executions, but this can be done without jenkins also.
We have one jenkins job which executes a UFT test first and then executes the selenium test if UFT test is successfull.
At the end of test execution UFT test will generate a file with the information required by selenium test and then jenkins will trigger selenium test, selenium test will read this file to gather any required information.
Results are interpreted in the following way
If UFT test fails then jenkins will not trigger the selenium test. If the whole jenkins job is executed successfully then integration is working, if the UFT part failed then Powerbuilder is having issue and if selenium part failed then web application is having issue.

jenkins selenium tests ci

I have created a Jenkins maven task to run selenium tests on one project, and now I want to use these selenium test in a proper way for CI.
Actually, I have a Jenkins task which 1-builds the project, 2- uses sonar, 3 - deploys the project. I would like to add the selenium tests to this process. The question is: can I run the selenium tests before deployment? Is it necessary to do a previous deploy for the selenium tests before the real deployment? Is there anyway to simulate a deployment or something like that so I can run the selenium tests?I would appreciate If you could advise me on how to do or any plugin which could help me.
As per my understanding, To deal with the scenario you should run the selenium test on QA environment. If all test pass then deployment should start for staging etc.
Additionally, once the deployment is done on staging, then selenium script should run again, test staging and if something went wrong then rollback from staging should be happened.
I never tried it but you can use below github plug-in for deployment(in case you are using github) :-
https://wiki.jenkins.io/display/JENKINS/GitHub+plugin
If you are using SVN then use below :-
https://www.packtpub.com/mapt/book/application_development/9781783553471/3
Hope it will help you :)

Launching Selenium test from bookmark?

I have some Selenium IDE scripts for automating tasks (deploying to an internal server via it's web interface), and I want to have bookmarks to launch them.
Don't want go to Tools -> Selenium IDE -> search test -> launch test, just want to click a bookmark and let the script run.
How can I achieve this? Am I missing a point?
Don't know if it makes a difference, but I'm currently using Firefox (if I have to change browser for this, it wouldn't be a problem).
Thanks
Not sure whether you be able to run tests pressing on a bookmark as browser plugins are usually run with a key combo. And bookmark is URL. Well the main issue in your question how to associate bookmark
with browser addon launching.
Well, I've investigated a lil bit workaround. Speaking about getting Selenium HTML Test Suites Running Automatically (i mean an alternative to bookmarks) some solutions are possible:
solution 1:
Patch the Selenium server code to support HTML suites.
Build a script to execute your HTML test suites.
Build a script to read the suites’ output reports and consolidate
the information for inclusion into your CC.NET report.
Setup details you can get here
Solution 2:
Selenium IDE plugin for Firefox to create tests
Java to run Selenium Server
Selenium Server to run test suites
Nant to generate reports for CruiseControl.NET
CruiseControl.Net as a continuous integration engine
Setup details here
Hope this be useful for you.
Bookmarks are nothing else than URLs, which makes it impossible to "bookmark" a functionality of a plugin, such as the Selenium IDE.
However, there might be other plugins out there that do what you want. I haven't had a closer look at it, but one candidate could be the Favorites (Selenium IDE) Firefox Add-on.

how to use Selenium to create an automatic tool to check mail status?

how to use Selenium to create an automatic tool to check mail status? I mean this toolkit could period duly open browser and check in my online mailbox to check if there are unread mails, if there has then change the status as "read" would be okay.
I currently was searching the selenium framework and could use it achieve some basic function, but have no idea of how to make it auto run and by fixed time interval. Can someone please guide me? any suggestion would be appreciated!
thanks!
The selenium standalone jar is executable so you could write a script to run selenium tests that you've created inside the Selenium IDE. It'd be something like this:
java -jar selenium-server-standalone-2.8.0.jar -htmlSuite "<path to your .html test suite>"
Then, you could schedule this as a cron job to run periodically.
Here are two related questions that might help:
Run Selenium Test Automatically Every 5 minutes
How can I run a selenium test every 5 minutes?