Learn Server Testing with TDD

Learn to use test-driven development to create a JavaScript server using the Express framework.

Start[missing "en.views.course_landing_page.learn-testing-for-web-development.course_illustration" translation]
Chevron Left Icon
Server Testing Stack
Lesson 1 of 2
Chevron Right Icon
  1. 1

    When testing an application, feature tests expose required tests or implementations at different levels of the application technology stack. One of those levels is the backend server. Server test...

  2. 2

    When writing tests, sometimes you'll find that the tests require calculation steps or inline code to determine if the test is passing. For example, to test if an array [...] includes an element ...

  3. 3

    Our back-end server is serving dynamic HTML to the user. For the homepage, this is located in the jsdom-test.js file to the right. It is possible to use [...] to verify that the HTML response...

  4. 4

    A server typically handles many requests at a time, but may be only capable of processing a subset of the requests concurrently. One side effect of this is that the server response time is neither ...

  5. 5

    As you may have noticed in the previous exercise, we are using the function [...] to make server calls to support our tests. This is actually a reference to the SuperTest library: [...] This...

  6. 6

    In this lesson we covered a set of technologies used for testing a Node server. These included: - Chai - a library for extending the built in Node assertion library - jsdom - a library for inte...

  1. 1

    In general, it is up to the developer to make a judgement call on how in depth to write a test. Every test written adds time to the testing cycle and can require maintenance if changes are made to ...

  2. 2

    Server tests are slightly faster than browser-driven feature tests. Since the web browser is cut out of the test, we are not testing how things are rendered for the user. Instead, we are focused ...

  3. 3

    In the previous exercise, we checked that the server responded with specific status codes. Now we need to make sure the server is responding with the correct content. Specifically, we are looking a...

  4. 4

    In the previous exercise, we checked that the server responded with a specific message. On our home page, the title is constant for everyone, "Messaging App". What if we want to create a profile ...

  5. 5

    Sometimes during the reflection of the refactor phase, you will realize that you can implement something better or more efficiently. In the code so far, we have been responding with inline HTML st...

  6. 6

    As mentioned earlier, one of the use cases for server testing is for checking API responses, especially the "sad path" where a user interacts with the server in an unexpected or disallowed manner. ...

  7. 7

    We used several technologies to write tests for both "happy" and "sad" paths of:

    • Server status codes
    • Server response content
    • Error cases

    We also saw how TDD can be used at the server level t...

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo

Learn Server Testing with TDD

Start[missing "en.views.course_landing_page.learn-testing-for-web-development.course_illustration" translation]