Prof. K.
Navya
Assistant Professor
Department of ISE
LAB PROGRAM -3
Course Name : DEVOPS
Course Code:BCSL657D
3. Working with Gradle: Setting Up a Gradle Project,
Understanding Build Scripts (Groovy and Kotlin DSL),
Dependency Management and Task Automation.
Gradle Project Overview
1: Setting Up a Gradle Project
• Install Gradle (If you haven’t already):
• Create a new Gradle project: You can set up a new Gradle project using
the Gradle Wrapper or manually. Using the Gradle Wrapper is the
preferred approach as it ensures your project will use the correct version
of Gradle.
To create a new Gradle project using the command line:
• This command creates a new Java application project with a
sample build.gradle file.
package com.example;
public class AdditionOperation
{
public static void main(String[] args)
{
double num1 = 5;
double num2 = 10;
double sum = num1 + num2;
System.out.printf("The sum of %.2f and %.2f is %.2f%n", num1,
num2, sum);
}
}
package com.example;
import org.junit.Test;
import static org.junit.Assert.*;
public class AdditionOperationTest
{
@
Testpublic void testAddition()
{
double num1 = 5;
double num2 = 10;
double expectedSum = num1 + num2;
double actualSum = num1 + num2;
assertEquals(expectedSum, actualSum, 0.01);
}
}