Coder Social home page Coder Social logo

njit-testing-workshop's Introduction

NJIT-Testing-Workshop

This repo is intended for demonstrating how unit testing works in a professional setting. We will be using Sonarqube to do our code analysis with our simple python project. You'll be needing to install a few items to get started. Although installing Sonarqube is not necessary, this readme will provide simple instructions to install Sonarqube locally.

Installing SonarQube

The following instructions will be installing SonarQube locally (PC/Laptop) on Windows.

You'll need to install two items for SonarQube, the SonarQube Platform and the SonarScanner. Read more about the difference here

To install the SonarQube Platform you can go to https://www.sonarsource.com/products/sonarqube/downloads/ and installed the community edition. After installing the platform you can install the SonarScanner here. Once downloaded you'll need to extract both zip files and then go to the SonarQube Platform folder and you can click on the SonarStart.exe to start it.

PainPoints to be mindful

  1. Storage - Make sure you have enough storage space when installing SonarQube locally. At the time of this, I had an issue where it was requesting at least 50gbs of free space.
  2. Java Version - In the requirement section you'll see that you need Java version 11 or 17 to run SonarQube. I went with 17 because version 11 was deprecated. Go to your CMD and type the command below to check what version number you currently have.

CMD:

java -version

Note: If you have another version of Java installed you can change your environment variables to set version 17 as the default path.

Installing PyTest

You'll need to install PyTest by using the command below. This is the testing libraries we will be using for Python. To view examples of how we will use them within this project you can click here

For more instructions you can visit their site: https://docs.pytest.org/en/7.4.x/getting-started.html

CMD:

pip install -U pytest

Running Tests with Pytest

python3 -m pytest

or

pytest

Installing Coverage

The final item you'll need to install is Python Coverage. This package will be used to create the report that will be feed into sonarqube to analysis.

For more insturctions you can visit their site: https://coverage.readthedocs.io/en/7.3.2/

CMD:

python3 -m pip install coverage

Running Coverage

python3 -m coverage run -m test_bank

Workshop Instructions

Test Driven Development (TDD)

Banking Application

Project Overview:​

You are a new software engineer for a small credit union. The Credit Union is looking to modernize and has hired you to help develop software for their ATMs. As it stands, the application is lacking in the required features.

It is your responsibility to implement the required tests and features needed to create a well-tested and functional application.

Objectives:​

  • Create In-depth unit tests for all functions of the application.

  • Implement necessary features into the application.

​​Requirements/Task(s):​

  1. Clone the GitHub Repository

  2. Switch and work off the NJIT---Testing-Branch

  3. Create your assigned function(s) for the application.

  4. Stage and commit your changes.

  5. Push your changes to the NJIT---Testing-Branch.

  6. ​​Add the link to your project here:​

    a. Github Repo: https://github.com/PeePeePirate/NJIT-Testing-Workshop.git

Deposit Function requirements:

  • Input validation tests

  • Letters

  • Characters

  • Bool

  • Account balance in negative

  • Account balance zero

  • Account balance in the positive

Withdraw function requirements:

  • Input validation

  • Letters

  • Characters

  • Bool

  • Withdraw to zero

  • Withdraw to positive or negative

njit-testing-workshop's People

Contributors

peepeepirate avatar hendevmen avatar glennonr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.