Skip to content

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.

Notifications You must be signed in to change notification settings

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

No packages published

Contributors 3

  •  
  •  
  •  

Languages