Git Product home page Git Product logo

testing-learn's Introduction

testing-learn

How to excel at testing

  • the basics
  • what makes a good test
  • is your code testable? structure matters
  • testing clean architecture
  • testing dependency or infra
  • testing complex pipeline
  • unit testing technique
  • how to unit test microservice
  • testing in containerized application
  • how to cover all combinations of scenarios?
  • how does testing relate to user story/requirements/use cases?
  • writing user stories
  • writing bdd - come up with a list of examples
  • specification by examples
  • writing use cases
  • writing readme

Scenarios

Take for example for user registration, we have the following variables:

  • user state: registered/not registered
  • email state: valid email/not valid email
  • password state: valid password/not valid password

Which leaves us with the following combinations:

2x2x2 = 8 combinations

But since if the user is already registered, there are no possible combinations after that, that leaves us with only five test cases that needs to be covered, namely:

given that the user is already registered,
  when I register with email [email protected] and password 12345678
  then the account should not be created
  and I should receive an error

given that the user is not registered,
  // Single test vs multiple input test below.
  // when I register with email [email protected] and password 12345678
  // then an account should be created

  when I register with invalid email (list of invalid emails) and invalid password (list of valid passwords)
  then an account should not be created
  and I should receive an error

  when I register with valid email (list of valid emails) and invalid password (list of invalid passwords)
  then an account should not be created
  and I should receive an error

  when I register with invalid email (list of invalid emails) and valid password (list of valid passwords)
  then an account should not be created
  and I should receive an error
  
  when I register with valid email (list of valid emails) and valid password (list of valid passwords)
  then an account should be created

Test the scenario that will cause failure first - that is the priority. Test the success scenario last. For password, there are actually two scenarios, which is valid (length validation, format etc) and correctness (it matches the user password). Also, we want to ensure that the user's password is not stored as plain text in the db, so it should be an additional test too.

Fuzz Testing (Fuzzing)

https://en.wikipedia.org/wiki/American_fuzzy_lop_(fuzzer)

QuickCheck

Property testing.

String

Prepare fixtures for text:

  • Long/short
  • No whitespace long
  • Empty
  • Just white space
  • Start white space
  • End white space
  • Chinese
  • Korean
  • Accented
  • Foreign
  • Emoji
  • Scripts
  • SQL injection
  • Links
  • Promo code
  • Email
  • Phone number

testing-learn's People

Contributors

alextanhongpin avatar

Watchers

James Cloos 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.