Skip to content

mohammedsohail-dev/QAtesting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Moving-Robot Simulator

Java Maven JUnit Coverage

This Java-based Robot Simulator lets you control a robot in a 2D room using simple text commands. It supports movement, pen up/down drawing, grid printing, and boundary validation. Tests and coverage are integrated using JUnit and JaCoCo.

📁 Project Structure

Moving-Robot-main/
├── src/
│ ├── main/java/sourceCode/
│ │ └── Robot.java # Core logic for robot movement
│ └── test/java/test/
│ ├── RobotTest.java # JUnit tests for robot logic
│ └── QATest.java # Additional tests for edge cases
├── target/ # Compiled classes and reports
├── pom.xml # Maven configuration
└── README.md

🔧 Features

  • I n – Initialize the grid (e.g., I 5 for 5x5)
  • M n – Move the robot forward n steps
  • L / R – Turn left or right
  • U / D – Pen up or pen down
  • P – Print the room grid and robot's path
  • C – Print robot's current status (position, direction, pen)

Includes boundary checks, invalid command handling, and a clear room printout.


🚀 Getting Started

📋 Prerequisites

  • Java 8+
  • Maven 3+

📦 Install and Run

git clone https://github.com/mohammedsohail-dev/QAtesting.git
cd Moving-Robot-main
mvn clean compile

🧪 Testing & Coverage ✅ Run Unit Tests

mvn test

Uses JUnit 4 (for RobotTest.java) and JUnit 5 (QATest.java).

JUnit Vintage engine bridges the two.

📊 Generate JaCoCo Coverage Report

mvn clean test
mvn package

Then open the report:

target/site/jacoco/index.html

View detailed method and line-level coverage. 💡 Sample Commands

I 5
D
M 3
R
M 2
C
P

Expected output:

Robot moves 3 steps forward with pen down.

Turns right and moves 2 steps.

Room grid printed with * marking the path.

About

This Java-based Robot Simulator lets you control a robot in a 2D room using simple text commands. It supports movement, pen up/down drawing, grid printing, and boundary validation. Tests and coverage are integrated using JUnit and JaCoCo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages