JSFoo 2018

JSFoo 2018

On JavaScript and Security

Deepak Pathania


The art of writing mature tests

Submitted Mar 30, 2018

As developers, we are all well aware of the importance of writing tests. Whether it is the safeguard against letting silly bugs slide in production code or enforcing certain styles and practices for everyone involved in contributing to the code base, we can all agree that writing tests is an important part of the development lifecycle.
But there is something else also we can all agree on.


This talk was born out of the sheer frustration of:

  • Writing hundreds and thousands of tests and then modifying them all because of a slight change in the code base.
  • Spending more time writing tests than the actual code.
  • Spending hours going through fixtures to find out where the tests are breaking.
  • Mocking and stubbing and faking and what not just to create an ideal test scenario.
  • Re-running pipelines and hoping the flaky tests don’t pop up again.
  • Struggling with the assertion failures, stack traces and error messages to figure out what went wrong and where.

And you get the idea. We went back and forth with a lot of different test strategies and a few things finally clicked and made sense. This is an attempt to share all those learnings with developers who have faced the issues mentioned above during writing or fixing tests, in the hope that these can be used as standards moving forward to save you and your team from hours of frustration.


  • Introduction
  • What not to expect
    • recommendations or comparisons b/w diff testing tools.
    • preaching about writing testable js from the beginning.
  • What to expect
    • things you can do to improve existing tests without drastic changes.
  • Why write tests?
    • Not the obvious reasons.
    • The developer perspective
  • Current scenario
    • The test monolith.
    • Common mistakes and avoiding them.
    • Code samples explaining the mistakes and solutions.
  • Moving towards better tests.
    • Minimalism and extraction is the key.
    • Bringing everything together for a new testing strategy.
    • Test scenario and solving it through new devised strategy.
    • Better test Design
  • Conclusion.

Speaker bio

Product Engineer @Postman. Full stack web developer with a keen eye for building elegant interfaces and a proven record of writing scalable backend code. Loves everything javascript. Speaks at conferences, meetups, hackathons and generally all the time. Likes open source, startups, and people.





{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}