Giter Club home page Giter Club logo

untangle-your-spaghetti-test-code's Introduction

Untangle Your Spaghetti Test Code

Build Sonar Quality Gate Sonar Coverage

Open in Gitpod

Setup

  1. Login to GitHub or create an account.

  2. Create a new workspace at Gitpod. This usually takes a little while, just be patient.

  3. Open ApplicationTest from the file tree on the left and wait for the Java installation to finish.

    A box will appear on the bottom right, saying Opening Java Projects, you can click on check details to follow the installation progress.

  4. After the installation is done, you can right-click into the code, and select Run test at Cursor (to run a single test) or Run Tests in Current File (to run all tests).

Structure

classDiagram
    direction LR
    class Application {
        <<springBootApplication>>
    }
    namespace unicorn {
       class Unicorn {
           <<record>>
          -id: UUID
          -name: String
          -maneColor: ManeColor
          -hornLength: Integer
          -hornDiameter: Integer
          -dateOfBirth: LocalDate
       }

       class ManeColor {
           <<enumeration>>
       }

       class UnicornController {
           <<controller>>
        }

        class UnicornService {
            <<service>>
        }

        class UnicornRepository {
            <<repository>>
        }
    }
    UnicornController --o UnicornService
    UnicornService --o UnicornRepository
    UnicornController -- Unicorn
    UnicornService -- Unicorn
    UnicornRepository -- Unicorn
    Unicorn --* ManeColor
Loading

Objectives

Feel free to use the Cheat Sheet for inspiration.

  1. Have a look at the ApplicationTest.

    Brainstorm: Which problems do you see?
    • Do you understand what's being tested?

    • Is there a proper arrange, act, assert structure in the test cases?

    • Are the names of test cases and variables consistent?

      Does it help to understand implications of failures?

      Does it help to find the corresponding code?

    • Do you understand how the test works technically?

    • Do you see where the test data is coming from?

    • Which code duplications do you find?

      How would you reduce them?

    • Are the Test Code Quality Criteria applied?

  2. Ensemble: Let's untangle it!

  3. Have a look at the test at UnicornServiceTest, UnicornControllerTest and UnicornTest.

    Brainstorm: Which problems do you see?
    • Which layer of the testing pyramid is this test on?

      Is the layer appropriate for the test cases? Can we move tests here?

References

untangle-your-spaghetti-test-code's People

Contributors

dependabot[bot] avatar christianbaumann avatar mkutz avatar christian-baumann-mw avatar stefanscheidt avatar

Stargazers

 avatar Thomas Mohaupt avatar Cyrus Kalant avatar Mo Ghasemi avatar  avatar  avatar Mark Tennyson avatar Israel Santiago avatar  avatar

Watchers

 avatar  avatar  avatar  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.