Implementing TDD midway through a project [closed] - unit-testing

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am currently at about the 50% point in a web app's development, getting to this point by rapidly coding followed by refactoring. After reviewing with the client again at this point, the scope of the project required for completion is clear and unlikely to change.
Is it advised at this point to start implementing tests? If so, do I create tests for the functionality already completed or prioritize TDD for the remaining parts of the application?

As mentioned in the comment by #zerkms it is usually advisable to use TDD for new functionality, and when you change existing behaviour.
To guard the functionality you currently have, use some integration tests and smoke tests for some typical, and crucial scenarios. Don't aim to achieve high coverage with these tests, as it will be to much of a burden to maintain them in the future. If you will be persistent at writing unit tests for discovered bugs and new stuff in time you will get high coverage.

Related

Can you write a unit test for a unit test? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Kind of a meta question, but I was wondering if there would ever be cases where writing a unit test for a unit test would make sense.
You don't have to write a test for that, generally its considered Mutation Testing.
Mutation Testing is a type of software testing in which certain statements of the source code are changed/mutated to check if the test cases are able to find errors in source code. The goal of Mutation Testing is ensuring the quality of test cases in terms of robustness that it should fail the mutated source code.
From Guru99
There's a few well known examples,
PIT for Java
MytPy for Python
Stryker looks like its the one for Javascript.
You could write you own tests that mutate your code itself, but its sensible to use OSS projects and help contribute to them if theres any unique needs given the complexity of the area. You don't want to have to own your own mutating framework either and all the maintance with that.

Should beginner programmers use unit testing? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have been learning PHP for several months now. It is not my first language, but it is the first language I have tried to use for real-life projects. Currently I am writing a web application that can be easy for experienced programmers but is rather hard for me. And the more I write it, the more I realise that I spend more time pressing buttons and entering inputs to test my code than actually writing code. I have heard about unit testing (and other kind of testing) and it got me wondering: does my simple web application need any automated testing or is it a complete overkill? Is unit testing something a beginner can learn or is it only something experienced programmers use correctly? And since I am writing a web application, can all its code be tested or only the small logic parts?
Thank you.
Everything can be tested just fine. I definitely think you should use unit tests if you spend that much time typing input. There is no difference between coding the unit tests and the application itself so experience shouldn't matter. Although it can be difficult to come up with good unit tests that cover all the edge cases.

Is it acceptable to create unit tests only after qa testing is done? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I came to know that in some shops, code is developed first, given to QA for testing and then developers write unit tests for that code. Is this approach acceptable ? If yes, then what are the pros & cons ?
I got some clues in answers in an unrelated question : Is Unit Testing worth the effort?
But, I also need answers specifically for my question.
A lot of serious dev "shops" do this.
When you develop complex applications for a client you never actually "care" about simple unit tests, the ones you can write any day of the coding project. You have to "test at a coarser level of granularity" (32:30 in the video) and you generally want to test things that are not supposed to change so you don't write tests over and over again, when the architecture changes a bit.
To answer your question: creating unit tests at the end is a fail safe for later, when you fix bugs making sure they don't break existing client required functionality. Writing tests at the end also gives you the insight you need to write them, the client's wishes are known and not subject to change any more.
Bottom line: It's not a science, you only get good at it while doing it.
PS: Not a fan, but this one is "right on the money" https://www.youtube.com/watch?v=9LfmrkyP81M

Software methodologies based on partial unit testing [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Considering that there are so many names for so many software methodologies out there, I would like to know if there is any recommending only partial unit testing.
I am a TDD believer, but sometimes I get the feeling of these two things:
Most of the thinking for a better and more maintainable structure/design is achieved mostly with the first tests of a class.
Unit tests are more important when working on someone else code
Therefore I suppose that out there, some people is writing about their experiences using a mid approach. I would like to do some self research on the topic and find out if I can get a "plan B" when pushing some TDD practices.
Is there any software methodology or trend based on partial unit testing?
You can write characterization tests on legacy code which capture the actual behavior of the code. Here's a good demo of the process: https://www.youtube.com/watch?v=J4dlF0kcThQ

QUnit vs Jasmine? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
What are the main differences between these two testing frameworks?
I am a totally new to Test Driven Development and starting from the very beginning.
QUnit is very easy to get started with, as you only need to include two files and a little bit of markup, then you can start writing tests.
Jasmine strength, afaik is its BDD-style syntax, if that is something that you prefer (probably not a selling point for you) and tight integration into Ruby/Rails tools.
In the end both get the job done. I recommend to start with QUnit. Once you're feeling comfortable, try Jasmine and check if the BDD style fits better. If it does and you still want to keep using QUnit, you can add Pavlov to the mix, which provides BDD-style methods for QUnit.