parallel execution in selenium without using testng - java

Till now I am running multiple scripts in parallel in selenium using testNG framework. Now I have to run these scripts in parallel using only java with out using any framework. Is there any possible way?

Firstly, You have to do is to set Global env. variable "ClassPath", in which you have to mention path of all classes(Selenium Jars and other classes also if used) which is used in Selenium Script.
Then you can run multiple Selenium Scripts from CMD at same time and to make process easy you can also create BAT files. You can also schedule Selenium Script with BAT files.
Hope my answer will help you.
Thank You,
Ed D, India.

Related

How can I run exported Selenium IDE Test against different browsers

Hello I'm having trouble running Selenium test created by Selenium IDE.
My main problem is that I don't know where to go.
I created a test in the Selenium IDE. I can make it work on Firefox from the IDE and save it in HTML, java, python, C#, Perl. That was the first ( easy ) part.
I would now like to execute the same test on another browser ( doesn't matter the language but I will focus on letting the test himself either in HTML or java).
That's where I don't know where to go. The IDE documentation talk about " using a simple command-line interface that invokes the Selenium-RC server. " but on other part of the website you can see that Selenium RC is officially deprecated.
Things seems to be replaced by Selenium 1.0 + Selenium WebDriver where Selenium WebDriver fits in the same role as RC did.
Then on the download page you have this line:
-To run Selenium tests exported from IDE, use the Selenium Html Runner.
with a link to a jar and no documentation at all.
So, today which one should I use :
Selenium-RC server , Selenium WebDriver or the Selenium Html Runner ?
and how do they work, do my test cases need to stay in HTML or move to java?
The final goal is to run those tests using Jenkins, which also contains plugin for Selenium that may help.
Thanks for your answers.
Export you testcase as java file
Save this file some where in you machine
Download following jars:
TestNG (http://www.java2s.com/Code/Jar/t/Downloadtestng60jar.htm)
WebDriver (https://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar )
Open eclipse
Create a java project , add a package (Check your exported java file copy the package name and create a package)
6. Copy the java file to the newly created package , change the class name's first letter as small case
Add required jar file as follow: Both testng jar & selenium satndalone jar
Now change the driver, whcih ever you want: I have changed the ff driver to chrome
If you get any error like this:
add this following: You need to provide the chrome.exe location(in my case its 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe')
System.setProperty("webdriver.chrome.driver", "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe");
To run Selenium HtmlSuite by using Selenium-Standalone Server (Selenium RC):
http://www.seleniumhq.org/docs/05_selenium_rc.jsp#run-selenese-directly-within-the-server-using-htmlsuite
java -jar selenium-server.jar -htmlSuite "*firefox" "http://10.8.100.106" "C:\mytestsuite\mytestsuite.html" "C:\mytestsuite\results.html"
But I think WebDriver has retired/changed that format.

Selenium-java,TestNG and jenkins on CentOS

I have recently setup integration of Selenium (Java bindings) with TestNG and Jenkins in a Windows environment, which is running absolutely fine.
I have created a batch file of TestNG and executed it through Jenkins using Windows batch file command. Now the situation is that I have to run these Selenium test cases on a Linux (Centos 7) environment as the Jenkins is setup there.
I am not quite sure how I should approach that. I have gone through some articles, but really could not find anything related to this for Selenium/Java things.
I have already done some initial steps, but I'm stuck after that:
I have setup CentOS 7;
Installed Java on it;
Installed Jenkins on it;
I have also installed xvfb as it would be required for headless execution.
From here I need some guidance in terms of how to proceed further, or put all things together. For example, should I move Selenium/Java project on VM and somehow run the TestNG file through Jenkins? (but not sure how to do that need some steps to follow or are there any more prerequisite to it). Or some other approach which is better.
It would be great if someone can guide me towards any article or can explain here with steps.
Here's what you can try doing to get this working:
You need a version control system(VCS) such as GIT/SVN, wherein you would need to push in your test code. That way, your Jenkins Instance will be able to pull in code from the VCS.
Once you have pushed in your code into the VCS, you can create a build job which would pull code from your VCS, build it using a build tool such as Maven/Gradle/Ant and then execute your tests (again using the build tool)
To learn how to setup your Jenkins instance with Git (One of the popular VCS flavors), please refer to this blog.
To learn how to go about setting up a Continuous Integration system with Selenium, you can also refer to this blog post of mine.

automatically run external application, which use Cucumber for testing main application

We have application which use Cucumber framework for testing our second application, the applications runs on own processes (black box testing), currently we do following steps:
1) Run DB
2) Run main application
3) Run test application which use Cukumber framework for testing main application
Question is: how we can do this automatically by using TeamCity ?
Create a Command Line build step:
Point to the working directory
Run your Cucumber tests from the command line. Example.
Here is more info on Cucumber's CLI.
My approach would be to write a script that sets up all dependencies. I.e. starting the database, starting the second application and then run the Cucumber stuff. The script would be possible to run on the CI server, i.e. TeamCity or on a developers system so it is easy verify that they didn't break anything before committing.
Restricting the execution to TeamCity only would not be my preferred approach.
This lead toa solution taht depends on your dev and CI environment. Are you running on Windows or on Linux? The scripts will different depending on the operating system.

How schedule Selenium WebDriver script execution

Please help me on this. I just want to run my selenium webdriver-Java Script at regular intervals using batch file in windows.
You can do it using jenkins. I feel it's a best way
Setup Jenkins first by refer my below answer in SO:-
How to Run TestNG Tests on Jenkins
Then set the setting of scheduler using jenkins as below:-
How to schedule jobs in Jenkins?
Hope it will help you :)

Run Java TestNG test from .Net

I have created a java project to run automated test cases for native app using appium and selenium.
Now our clients want to run that java project through .NET.
I have tried using ikvm.net but it says "Manifest doesn't contain a Main-class" because testNG class doesn't contain main class.
Can anybody suggest another way to achieve this?
As testng is for java you can do something like this:-
You can create a bash file for testng which is execute testng for java
Refer:-
http://stackoverflow.com/questions/32120102/bash-file-is-running-fine-in-windows-for-testng-but-it-is-not-working-in-linux-m
Now you need to execute that bash from a C# code
http://raspberrypi.stackexchange.com/questions/9474/how-can-i-run-a-terminal-command-bash-from-c-mono
Hope it will help you :)

Categories

Resources