[go: up one dir, main page]

0% found this document useful (0 votes)
13 views27 pages

Lab Program 3

The document outlines a lab program for a DevOps course, focusing on setting up a Gradle project. It includes instructions for installing Gradle, creating a new project, and provides sample Java code for an addition operation and its corresponding unit test. The use of Gradle Wrapper is emphasized for version management.

Uploaded by

Bhavana Biradar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views27 pages

Lab Program 3

The document outlines a lab program for a DevOps course, focusing on setting up a Gradle project. It includes instructions for installing Gradle, creating a new project, and provides sample Java code for an addition operation and its corresponding unit test. The use of Gradle Wrapper is emphasized for version management.

Uploaded by

Bhavana Biradar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

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);
}
}

You might also like