• 2
    Sometimes I try to atone for my sins and make lots of them, with fuzzing and stuff
  • 0
  • 2
    Or having a lot of tests for a product... But:

    It's a chaotic mix of unit, functional and acceptance tests

    Every test is written in a different style, using different ways to mock/fake things.

    Most stuff is tested either dozens of times, or is just testing whether 1 is still equal to 1.

    ...and it takes a lunch and two cups of coffer to wait for the testing suite to complete.
  • 3
    How to write tests?
  • 6
    @skiilaa Depends on the language.

    PHP? https://phpunit.de
    Java? https://junit.org
    Python? https://pytest.org
    JS? http://unitjs.com

    Just some examples... there are many ways to write tests.

    Unit tests are the most common, they test a "unit" of code (a single function), usually very thoroughly.

    Functional tests act more like a user: Click through an app, make automated requests, and test whether data is being stored in the database. They can be "heavy", because they hit a lot of systems and need to simulate a lot of things.

    Acceptance tests check whether your product is looking acceptable according to the specifications. It might check if all functionality is implemented, whether buttons are visible, etc.

    If you write your unit tests *first*, and then write function to make those tests not fail anymore... that's called test driven development, or TDD. If you write acceptance tests according to user stories and specs, you're getting closer to behavior driven development, or BDD.
  • 2
    @bittersweet I asked it sarcastically, but your answer was helpful. Thanks.
  • 2
    $this->assertEquals('sarcastic', $comments->getPreviousFromUser('skiilaa')->getType());

    $this->assertEquals('oblivious', $comments->getPreviousFromUser('bittersweet')->getType());

    Ah, that's better. ;)
  • 2
    @bittersweet your answer was actually very helpful to me since I never wrote any tests (dev is a hobby for now) and I never really looked at the process so thanks mate
    Make sense now
  • 0
    Thank goodness there are others!
  • 1
    Why not explore the beauties of unit tests?
  • 0
    @bittersweet that's not nice :(
  • 0
    @Gianlu Ah, yeah it's http. Have to try hard now not to make mean jokes about Java devs...
Add Comment