🌟 Day 7 of #100DaysOfCode: Embracing JUnit Testing! 🌟

Hey Invaders πŸ‘½

Today marks a significant milestone as I completed my Java Development Bootcamp and ventured into the exciting realm of JUnit Testing! πŸŽ‰πŸ’»

Learning Highlights:

  1. Unit Testing Fundamentals: Explored the essence of unit testing and how it ensures the reliability of my code through isolated tests. πŸ§ͺ

  2. The F.I.R.S.T. Principle: Embraced the principles of Fast, Isolated/Independent, Repeatable, Self-validating, and Timely tests to write effective test cases. 🌐

  3. JUnit5 Setup: Successfully set up my project with Gradle and integrated JUnit5 to streamline my testing process. πŸ› οΈ

  4. Arrange, Act, Assert: Mastered the AAA pattern to structure my tests seamlessly, ensuring clarity and effectiveness. πŸ“Š

New Endeavors with JUnit5:

Today, I embarked on writing my first JUnit test for the integerDivision method in the Calculator class. Here’s a sneak peek of my journey:

public class Calculator {

    public int integerDivision(int dividend, int divisor){
        return dividend/divisor;
    }
}
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class CalculatorTest {

    @Test
    void integerDivision(){
        //Arrange
        Calculator calculator= new Calculator();
        //Act
        int result = calculator.integerDivision(4,2);
        //Assert
        assertEquals(2, result,
        "Integer division did not produce expected 
        result");
    }

}

The cool thing about assertEquals which I never knew is that you can add a message to it so if the test fails you have a customized message telling you why!

Next Steps:

I'm thrilled to delve deeper into JUnit Testing, refining my skills to create robust and reliable tests for my Java applications. πŸš€

πŸ‘©β€πŸ’» Let’s Connect: Have you started your journey with JUnit Testing? Share your experiences and insights! Let's empower each other on this coding adventure. πŸ’¬πŸ€

Excited to bridge this testing gap! πŸ’‘ Follow my journey on GitHub too!

#100DaysOfCode #JUnitTesting #JavaDevelopment #CodingJourney #TechCommunity #ContinuousLearning #GrowthMindset #SoftwareTesting

Reply

or to participate.