Hey guys! Sorry if this isn’t the best place for this but I couldn’t really find anywhere else.

I’ve been working for 6/7 years as a web developer full-time now, and I’m still plagued by one mega frustrating habit. When I’m working on something complex on one page, and it gets completed, I’ll fairly often get notified either by the client or my boss a day or two later while they’re testing the whole site that there’s something broken on another page.

Almost always, it’ll be down to the fix I’ve recently made.

Is there a way to avoid this kind of tunnel vision? I try to keep my code localised as much as possible, avoiding interacting with global scope and, if it’s really for one specific thing, tying it down to that page in particular, but short of testing the entire site every time I make any change… is there anything else I can do?

Thanks!

You are viewing a single thread.
View all comments
7 points

Tests.
Target the “business logic”.
You can structure your code to facilitate unit or integration testing.
Setup tests for the key functionality. Whenever a bug gets reported, create a test or test case to address that bug, fix the bug, and ensure the test now passes.

Have a staging environment, so the site can be interacted with and tested without touching anything in production.
You can push to this often, and request some help with QA to ensure nothing is broken.

Have a testing environment. Again, a complete duplication of the infrastructure.
Set up end-to-end tests. These automate interactions with the entire application.
Have tests that run against key features. “Setup appropriate state, load form page, fill in form, click button, check that database entries are correct”… “setup appropriate state, check that submission summary shows correct data”.
These are quite handy, but a lot slower and fragile than unit and integration tests.

There are automated testing platforms that can capture a “good” state of a website, then use image matching to ensure further runs visually match what it should look like.
These are normally expensive and finiky.

Hopefully you will get to a stage with your testing that your unit and integration tests catch 90% of your potential bugs, and e2e tests will ensure the core functionality is working correctly.
Then, as you do a bunch of work, you can run your tests, see they all pass, and be confident.

Finally, I will say that tooling like frameworks and typescript can catch a lot of these errors quite quickly.
However, these won’t catch logic bugs - which is what tests are for.

permalink
report
reply

Web Development

!webdev@programming.dev

Create post

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

  • Follow the programming.dev site rules
  • Keep content related to web development
  • If what you’re posting relates to one of the related communities, crosspost it into there to help them grow
  • If youre posting an article older than two years put the year it was made in brackets after the title

Related Communities

Wormhole

Some webdev blogs

Not sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

Credits

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

Community stats

  • 6

    Monthly active users

  • 317

    Posts

  • 1.1K

    Comments