Creating Selenium Gradle Project in Eclipse
Gradle is open-source Build management and automation system based on Groovy-based Domain-specific language instead of XML files, unlike maven or ant. It is been created and disturbed by Apache.
S.No | Gradle | Maven |
1 | An open source build automation tool that is built on concepts of Apache Ant and Apache Maven. | It is compressive software project management tool used primarily for project build automation using Java. |
2 | Written in Java, Kotlin and Gradle. | It is written in Java. |
3 | Gradle Build time is short and fast. | Maven performance is slow as compared to Gradle. |
4 | Gradle Scripts are much short and cleaner. | Maven scripts are a bit lengthy as compared to Gradle. |
5 | It uses Domain-specific language (DSL) | It uses XML |
6 | It is based on the task using which work is performed. | In maven goals are defined which is linked to the project. |
7 | It supports incremental compilations of java class. | It does not support incremental compilations. |
Prerequisites
Gradle runs on all major operating systems and requires only a Java Development Kit version 8 or higher to run. To check, run java -version
. You should see something like this:
❯ java -version java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
Gradle ships with its own Groovy library, therefore Groovy does not need to be installed. Any existing Groovy installation is ignored by Gradle.
Gradle uses whatever JDK it finds in your path. Alternatively, you can set the JAVA_HOME
environment variable to point to the installation directory of the desired JDK.
SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix-like systems (macOS, Linux, Cygwin, Solaris and FreeBSD). We deploy and maintain the versions available from SDKMAN!.
❯ sdk install gradle
Homebrew is "the missing package manager for macOS".
❯ brew install gradle
Installing manually
Step 1. Download the latest Gradle distribution
The distribution ZIP file comes in two flavors:
Binary-only (bin)
Complete (all) with docs and sources
Need to work with an older version? See the releases page.
Step 2. Unpack the distribution
Linux & MacOS users
Unzip the distribution zip file in the directory of your choosing, e.g.:
❯ mkdir /opt/gradle ❯ unzip -d /opt/gradle gradle-6.5-bin.zip ❯ ls /opt/gradle/gradle-6.5 LICENSE NOTICE bin README init.d lib media
Microsoft Windows users
Create a new directory
C:\Gradle
with File Explorer.Open a second File Explorer window and go to the directory where the Gradle distribution was downloaded. Double-click the ZIP archive to expose the content. Drag the content folder
gradle-6.5
to your newly createdC:\Gradle
folder.Alternatively, you can unpack the Gradle distribution ZIP into
C:\Gradle
using an archiver tool of your choice.Step 3. Configure your system environment
To run Gradle, the path to the unpacked files from the Gradle website need to be on your terminal’s path. The steps to do this are different for each operating system.
Linux & MacOS users
Configure your
PATH
environment variable to include thebin
directory of the unzipped distribution, e.g.:❯ export PATH=$PATH:/opt/gradle/gradle-6.5/binAlternatively, you could also add the environment variable
GRADLE_HOME
and point this to the unzipped distribution. Instead of adding a specific version of Gradle to yourPATH
, you can add$GRADLE_HOME/bin
to yourPATH
. When upgrading to a different version of Gradle, just change theGRADLE_HOME
environment variable.Microsoft Windows users
In File Explorer right-click on the
This PC
(orComputer
) icon, then clickProperties
→Advanced System Settings
→Environmental Variables
.Under
System Variables
selectPath
, then clickEdit
. Add an entry forC:\Gradle\gradle-6.5\bin
. Click OK to save.Alternatively, you could also add the environment variable
GRADLE_HOME
and point this to the unzipped distribution. Instead of adding a specific version of Gradle to yourPath
, you can add%GRADLE_HOME%/bin
to yourPath
. When upgrading to a different version of Gradle, just change theGRADLE_HOME
environment variable.Verifying installation
Open a console (or a Windows command prompt) and run
gradle -v
to run gradle and display the version, e.g.:❯ gradle -v ------------------------------------------------------------ Gradle 6.5 ------------------------------------------------------------ (environment specific information)
2) In Our build.gradle we can create one new task lets name it as a test in this we need to give values like.
Here we need to select our gradle project and in arguments Tab, we need to enter the command gradle test as shown in below screen
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.