June 12, 2016

Free Udacity Course: Gradle for Android and Java

Want to more about Gradle? Sign up for a free course on Udacity!

Gradle for Android and Java 
https://www.udacity.com/course/gradle-for-android-and-java--ud867

https://www.udacity.com/course/gradle-for-android-and-java--ud867


When putting together an automation framework using Selenium WebDriver and Java, you need a way to store the dependencies. This is so you don't have to end up downloading every single third-party component, piece-by-piece. When I was taking a course in Selenium WebDriver 2 with Java, I was introduced to a tool called Maven to do this for me.

Maven was a pretty simple tool to set up. Gradle, though, is a bit more complex.

We have been using Gradle at my workplace ever since I first started my job as an automation engineer. It never was my job description to set up all the initial dependencies, the reporting and logging, design the build process, or set up the tasks, so Gradle was just another buzzword to me.

Lately, though, the senior members of the team have been using a lot more of its functionality. This is why, all of a sudden, blog posts on Gradle start appearing, such as:

A Free Course in Gradle!


I was referred to a free course on Gradle through Gradle.org and its tutorial section.

The course was put together by Mark Viera, Core Engineer at Gradle, and Jeremy Silver, a Udacity course developer.




Udacity's Welcome to Gradle!

Why Gradle? And Why This Course? 


When building a Java project, it's easy to build a small project. You compile the source file to create the classes. You bundle them into Jar (Java Archive) files for easy distribution.

But what if you want to generate documentation out of the code, assembling Javadocs? What if you wish to place the Jar files in a repository? Integrate unit tests, integration tests, or acceptance tests for a project?

For a large project, such as a Selenium WebDriver / Java automation framework, things get hairy.


Udacity’s Why Gradle?



Why does building software matter? And why Gradle?

It used to be that builders just compiled and packaged their source code. Now builds run tests, generate documentation, publish applications and manage dependencies. The build has become the software factory that processes the software.

Google wanted to find an all-in-one tool that did all that for their Android Studio. That is why they selected Gradle as the built-in build processor.

Udacity's Command Line Gradle


Installing Gradle:

Gradle knows how to install itself. All it needs is a shell script -- The Gradle Wrapper -- and a small JAR file -- gradle.jar -- to install itself. If Gradle is installed already, it will simply pass along the Gradle command command. If not, Gradle will install itself.

There are two types of Gradle wrappers:

  • gradlew: Wrapper for Mac / Linux
  • gradlew.bat: Wrapper for Windows


To run the grade wrapper:
./gradlew

Gradle then contacts http://services.gradle.org/distributions/ ... in the video, you can see it is grabbing and downloading gradle-2.3-bin-zip.

Tips Given Through the Course


Gradle takes a while to start up because it spins up an entire instance of the Java Virtual Machine. Using the Gradle Daemon speeds up this process. This daemon process is started, and continuously runs in the background, keeping the JVM instance alive. Later Gradle runs can use the same instance.

If you are using Android Studio, it is always explicitly running. From the command line, you have to explicitly enable it.

Free Homework Assignments!


This Udacity course even has coding exercises on GitHub at https://github.com/udacity/ud867 Jeremy Silver, the course developer for Udacity we were introduced to in the first video of the course, has over fifty exercises you can do.

Can't figure out the solution? Jeremy has included the answer in a solution.gradle folder.

Speaking from experience, the only way to truly learn the material is by doing the work yourself.

Have fun, and happy Testing!

-T.J. Maher
Sr. QA Engineer,
Fitbit-Boston

// QA Engineer since Aug. 1996
// Automation developer for [ 1 ] year and still counting!
// Check out Adventures in Automation on Facebook!

No comments: