I am using Maven as a build tool. On selniumhq site I can see selenium-server-standalone.jar file but I could not found related Maven dependency. Is there any maven dependency for selenium standalone file?
latest selenium standalone file is : selenium-server-standalone-3.2.0.jar
Note : I want to execute code on Remote desktop machine using Selenium grid (which require aforementioned jar file)
I think you should refer to this manual first: http://www.seleniumhq.org/docs/07_selenium_grid.jsp#starting-selenium-grid
i.e. in order to use grid you need you need to create grid instance first by running commands
from command line, then you need to register node, again by using command line, and after that from your code you need to create instance of RemoteWebDriver (refer to this page for more details: http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp#remotewebdriver).
If, for some reason, you want to to create grid\register nodes from your project maybe it makes sense to download it to your resources folder, execute it from there using Runtime (refer to this link for more details: http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html) and then connect to it. But I would strongly recommend avoiding doing so.
Related
I need to develop a automation package using selenium and send it over to a different location and completely different environment so that it will aid in the testing's happening there. It has to be able to be integrated with Jenkins for the build run. Also it should be a data driven package.
how will I be able to do that?
You need to create repository and upload the tests there and provide access to the client. You can use service like Github or Gitlab. You can have private repository for up to 3 contributors.
You can parametrize the test using property file or system property variables.
If you need more information about how the system properties work you can check this article: https://www.baeldung.com/java-system-get-property-vs-system-getenv
Something like this:
System.getProperty("log_dir", "/tmp/log");
mvn clean test -DpropertyName=value
If you want to send the project like a jar file then it will be like:
System.getProperty("baseUrl", "https://mywebsite.com");
java -jar jarName -DbaseUrl=https://someotheraddress.com
I am developing new pipeline within Jenkinsfile using intelliJ.
When I was using jenkins 1 with pipeline-dsl plugin I could go into the source code and see how DSL was actually implemented in org.jenkins-ci.plugins:job-dsl-core. I would like to have the same ability with Jenkinsfile.
Can I somehow connect Jenkinsfile DSL and intellij to have there proper code completion and sourcecode insight?
In order to have access to the sourcecode for the Pipeline Plugin suite of plugins when working on ANY Jenkins pipeline script, whether global or otherwise, you will have to include the necessary libraries as dependencies.
I'm working on my current global pipeline library.
Here adding the CPS library via "Project Structure" menu item:
Go to Libraries
Click the add button and select "From Maven..."
Type in the correct GAV (in this case com.cloudbees:groovy-cps:1.9)
Click the magnifying glass button - IntelliJ will search Maven Central (and whatever other repos you've configured in the Maven IntelliJ configuration or via your settings.xml) and download them to an your local cache.
Rinse and repeat until you've got all the dependencies you need.
When you're done, it should look something like this:
I found that the minimum useful were:
com.cloudbees:groovy-cps:1.9
org.jenkins-ci.plugins.workflow:workflow-api:2.+
Have you tried this approach yet?
Ok, so I'm working on a project using IntelliJ and trying to take advantage of its cucumber functionality. I've not worked with the java flavour of cucumber, but IntelliJ seems to want the step definition files in a specific location, relative to the feature files.
I found this: how to define step definitions location for cucumber in intelliJ 12 and other sources that pointed me to been able to add the "glue" property of my run configurations which tells cuke which package to find the step file. So I am at a point where I can run my tests via IDEA. BUT I need to set this every time I run a new test, as Ctrl+Alt+F10 or right click+run test will not start the test with this flag. Also, the ide support is screwed as IDEA doesn't know where the steps are, it doesn't auto complte or Ctrl+Click navigate to steps.
Is there a way to the the IDEA project to always look for steps in a given package both when running the tests and for its auto complete?
Creating self answer for others who might have this problem. My project did not have the steps marked as test source root, and although I DID do this, it was not until I closed and reopened my project that they were picked up. So a simple restart was my answer.
You can set the glue location globally by opening "Edit Configurations -> Defaults -> Cucumber Java -> Glue" and add the package names.
(IntelliJ 12.1.4)
Go File->Settings--> plugins
Install Cucumber for Java plugin
Then you can manage cucumber plugin as shown below
This should redirect you to step definition when you click your test.
Hope this helps
IntelliJ supports a plugin for Cucumber-Java/Groovy. Installing this plugin will enable the navigation from Steps mentioned in the feature file to the Step Definitions.
And after creating the Step Definition, navigation is easily possible
I go in EditConfiguration, Glue section and i put the path from the package above and the package where is your class for steps, ex:
CucumberFramework.stepsDefinitions
It is really nonsense :) but in in my case when IDEA refused to add steps definition automatically due to some plugins installed, e.g. Cucumber for Scala and suggested deleting them that i cant since i need them in other project. So, long story short, to add (Create step definition) you need to create Class in 'glue' dir and some fake Cucumber implementation, build one more time and it resolved my issue.
Background:
When I use IDEA 2018.2
And Java 8
And Cucumber info.cukes:cucumber-java:1.2.4
#When("^I created a Class and put there fake step implementation$")
#And("^I run gradle build one more time :)$")
#Then("^This Class will be able for me from the feature file by ALT+ENTER as usual$")
#And("^It resolved my issue when I was not able to automatically generate step definition$")
I've looked at the usage, but haven't understood from it how to configure multiple servers. I added separate server elements to settings.xml - but I don't understand how to specify a different URL for every server.
The URL element belongs to the global plugin configuration. How do I configure multiple server URLs?
You could add multiple profiles to your pom.xml. One for each server. Check the Maven documentation on profiles for details!
If you examine the documentation of the Tomcat plugin you will see that it does not support multiple <configuration> sections. That should be a small addition because in the deploy phase you only copy the WAR file to the server using an HTTP PUT command. So I wonder why they have not added this capability to the plugin.
Anyhow, one possible workaround is to:
Make multiple copies of your pom.xml in the same directory but give them unique names, e.g. dev_1_pom.xml, or dev_<some_machine_name_or_IP>, qa_1_pom.xml ..... You can keep your development pom.xml file name the same because you will likely still run Maven from the command line. Personally, I prefer running the mvn command from my IDE (a button click away vs. typing an mvn command with arguments every time).
In each of the copies, change the <configuration> section under your Tomcat plugin to point to a different server that matches the name of your specific pom.xml. You will need corresponding sections in settings.xml
Create corresponding External Tools Configuration(s) (Eclipse, or other IDE) and each one call the corresponding POM file. Here is an example with Eclipse:
Open External Tools Configuration Dialog in Eclipse (either from the dropdown menu next to the button, or by going to the menu bar and clicking Run > External Tools > External Tools Configurations). Then on the Main Tab, provide values for the following fields
Location: C:\downloads\tools\apache-maven-3.0.3\bin\mvn.bat
Working directory: ${workspace_loc:/<project_name>} - replace <project_name> with the name of your project
Arguments: -f <pom_file_name> <other_arguments> - <other_arguments> could be tomcat7:redeploy
Now you can run these external tool launchers individually to deploy to different servers.
Optionally, extract the mvn commands from your launchers and create a shell script (batch or Unix bash script) that runs all of them. That way you can deploy to multiple servers at once. You can also run this script from Eclipse. Create a new External Tools Configuration launcher but this time your Location: field will point to cmd (Windows) or bash (Unix, Linux ...), not mvn
I'm using PMEase QuickBuild to perform automated builds of our Maven2 projects and a nightly sanity test to ensure nothing is broken.
The test needs to untar packages which are created by the automated Maven2 projects. The problem is that the package names change frequently due to project versions being incremented all the time.
Does anyone know how I can configure QuickBuild to pick up the version (ideally from the POM file of the individual components), if this is possible at all?
I don't know if this is an option for you but it looks like you can do it the other way around. Quoting Build with Maven:
Control build version
If you want to control the build
version from QuickBuild side, please
follow below steps:
Change the POM file and define the project version as
${buildVersion}. Do not forget to
commit the file into your SCM after
change.
Define a build property like below when define the Maven build
step:
buildVersion=${build.version}
There are maybe other options but I must admit that my knowledge (zero) of QuickBuild is very limited
I created a work around to this issue by having QuickBuild execute a shell script which did the untarring by using wildcards, similar to the following (to avoid computing the exact version):
tar xzf filename-*.tar.gz
I couldn't figure out how to do this in QuickBuild, so I offloaded the work to the shell script.