Is it okay to place selenium and appium classes to src/main/java package or in src/test/java - selenium

We are creating a Selenium and Appium project in eclipse.
I was wondering if there are rules or right practices or correct location for Selenium and Appium classes?
During our training on Selenium, I notice that location of classes are in src/main/java.
While in our training on Appium the location of classes are in src/test/java.
Is it also okay to put the Selenium classes src/test/java?
Will there be any problem?
Or is it also okay to put Appium classes in src/main/java?
Will there be any problem?
What will be the best practice for locations of Selenium and Appium classes?
FYI, there will be no other code for the application. Just the Selenium and Appium classes.
TIA

Q. Is it also okay to put the Selenium classes src/test/java? Will there be any problem?
Ans: Yes it's absolutely fine, if you entire project is meant for test automation. There won't be any issue.
Q. Or is it also okay to put Appium classes in src/main/java? Will there be any problem?
Ans : Answer is again No
Since you've mentioned
there will be no other code for the application
It really does not matter if you keep your code in any one of the folders
Since It's a Maven project, main/java is for development and test/java is for unit test. Nothing more nothing less, it's all up to you to decide which one to go for.
Cause if you are using TestNg, in xml you would have to give the full file path in order to run the class file, so it does not really matter.

Related

Single driver instance using cucumber-jvm testng with maven

I was using junit as my testing framework with cucumber-jvm, selenium page factory pattern and maven. Now i have requirement to change it to Testng to execute parallel. Most of the blog says add extends AbstractTestNGCucumberTests in the runner class. but when i do that. I am getting nullpointer exception.
Can someone share your approach using testng with cucumber?
Can someone share your approach using testng with cucumber?
Teach a man to fish and all that. What I do when I have questions like this is to go the cucumber-jvm example page.
Take a look at java-calculator-testng.
Try to implement this sample project locally on your computer and get it working. Now that you have a working example extended it to do what you need to be done.
I hope this helped. A full example would take a lot of space.

Automation tests using Cucumber, SoapUI and Selenium

I'd like to use Cucumber linked with SoapUI and Selenium in order to create an automation functional test.
I only found one website about it, describing that first I have to create a SoapUI project and save it as a .xml file. Then I should include this file into the test project using Cucumber and Selenium.
My first question is what configuration do I have to do for that ? (in the pom.xml file when using Maven for example or in any configuration file for Jenkins)
My second and last question is : if I launch every night with Jenkins (let's say that as an example) my tests, do I have to launch first the SoapUI project and import it again in the test project to run my tests in a good way ?
Thanks for your answers
I think you can use REST Assured for you API testing.
Use cucumber for your BDD statement, use java for there step definition and REST Assured for all the API request stuff.
Wrap all your automation with well written Gherkin and you'll need no other documentation. Think about that. BDD (specification by example) is a requirements approach, not a testing approach.

How to run Serenity BDD Test cases in IE and chrome

Can some one help me to know how to run Serenity BDD test cases in IE and chrome browser, I tried the way it said in it's doc and other posts at stack over flow, did not work for . I am using Serenity BDD version is 1.1.1. Help from any one you will be appreciated very much.
The easiest way is to create a serenity.properties file in the project root, with the line driver=chrome or driver=iexplorer
You can also use the same arguments as system properties. Here's the full list of settings:
http://thucydides.info/docs/serenity/#_running_serenity_tests_from_the_command_line

Help with Selenium Webdriver download?

I have Selenium IDE and i want to install Selenium Webdriver.
1) Can anyone tell me where can i download selenium webdriver. i don't see any link available in the documentation.
2)Can i use selenium webdriver with PHPUnit? I see some materials saying php is not supported in selenium 2 however there are some download links available for phpbindings for webdriver what is this exactly?
3)If i have Selenium webdriver do i still need selenium server to run test cases in different browsers?
I would appreciate your answers...
I completely agree with you. They have a ton of documentation, but they do a horrible job of explaining what you actually need. It took me about 2 days to put all the pieces together. You will need a few things...
If you are running tests with C#, download NUnit, C# client drivers. Create a class library project in Visual Studio and reference the dlls (assemblies) for NUnit (for appropriate dotnet version) and the C# client drivers. Compile your class library. It should create a dll inside of the bin\Debug directory. Then go into NUnit, create a project, and then open your assembly in that bin\Debug directory. That should get you started.
If you're developing using Java, download JUnit (not NUnit) and then download the Java Client Drivers, and use Eclipse instead of Visual Studio. You can launch JUnit right from Eclipse.
I've only tried NUnit and JUnit before. But I'm sure PHPUnit can also be launched from Eclipse (educated guess). There seems to be the most documentation for Java and Python.. from experience, but I've been doing everything in .NET and I haven't had anything I couldn't solve.
The Unit Testing software isn't required, but the code the format add-ins for Firefox Selenium IDE will build the code for NUnit (C#) or JUnit (Java), etc... so most use those tools.
If you want to get some boilerplate code, go into Selenium IDE and turn on experimental features under options. Then export your C# code (or Java code) from the format menu after you've recorded your commands. It won't all convert 100%, so be aware of that. Just google from there to get questions answered.
One thing to watch out for... clickAndWait commands won't convert to click and wait in the code. You will either need to do an implicit wait or a thread.sleep wait after certain commands before you'll be able to access the next element if you're waiting for an action to occur. You will also want to turn on native events so you can fire certain JavaScript events. Your fire events won't work if the driver doesn't have this turned on. The WebDriver driver.
If you have any other questions, let me know.
You can download Selenium server as well as client driver from the following:
http://code.google.com/p/selenium/downloads/list
You can download "php-webdriver-bindings-0.9.0.zip" from the following source:
http://code.google.com/p/php-webdriver-bindings/downloads/detail?name=php-webdriver-bindings-0.9.0.zip
In C# context:
Now the better way of including packages in C# project is using nuGet. nuGet is packaging utility which when executed from its powershell command window, quickly downloads the dll files and links them to project. Below link details on how to use nUGet to install packages of selenium webdriver, selenium support and nUnit.
How to invoke/run different type of web driver browser using remote webdriver in C#

Selenium Grid + Maven 2

Is there a good tutorial or does anyone have experience with setting this up ?
I have a Testsuite.html which launches my tests in one browser atm. This is done in the integration-test lifecycle by the maven selenium plugin. I want to run my tests on multiple browsers. I couldn't find any documentation about selenium grid + maven. I hope somebody can help me.
Thanks in advance, kukudas
Selenium Grid and maven are really not much different than Selenium and maven.
Grid is basically a drop-in replacement for selenium-rc. In our current setup we let the automated build system use Grid. It does this by simply changing the selenium-rc url (which is normally localhost:4444) to the grid's url.
Additionally we specify the browser string (*firefox, *iexplore, *opera or whatever) as a system property on the mvn command line, which we pick up when we initialize the selenium client libraries in our code.
So the way we've done it we basically set up 4 different build projects with different browser strings.