Move What is testing for a developer?
LUCIAN
Open What is testing for a developer?
How to think about testing as a developer
High level overview
In any project, there is an area called Quality Management that has two main activities:
- Quality Assurance - mostly means measuring quality via various processes and tools either during the production and/or looking at the end result
- Quality Control - making sure we have processes in place that will guide, verify and change the organisation and in-place processes to assure a certain level of quality built-in
From this perspective, Testing is the outcome of a Quality Control decision and is an activity part of Quality Assurance.
When doing side projects, for example, Quality Management is informal, and you mainly represent it. You decide (or not - but still a decision) what quality you want to have and how much, if anything, you want to do about it.
I will not go too deep into the Quality Management process, but it is good to know that testing is not just dropped into a project. Still, it should be part of a bigger stra
What is testing for a developer?
732 words
Move Testing public methods vs private methods
LUCIAN
Open Testing public methods vs private methods
Testing public methods vs private methods
The features or logic of private methods should be tested through public methods, but the private methods should not be tested themselves.
A short intro
Before reading this article, please focus on testing rather than code design. You might need to refactor or debate the code's shape, organization, or naming. While your proposals may be good, we are here to discuss testing, not OOP code design. I like to work with code that is not perfect because in day-to-day activities, we work with code like this, and so it pins down the theory and helps us focus on talking about practical advice.
A simple case
Here is a piece of code from Maybe.co:
module ImportsHelper
def permitted_import_configuration_path(import)
if permitted_import_types.include?(import.type.underscore)
"import/configurations/#{import.type.underscore}"
else
r
Testing public methods vs private methods
969 words
Move Applied test case design: Zammad example
LUCIAN
Open Applied test case design: Zammad example
Applied Test Case Design: Zammad example
I reviewed various open-source Rails apps on my blog and looked their source code. As I already have them on my computer, it would be a good idea to do some test designs on real code examples.
One of the open-source apps that I was reviewed on my blog was Zammad.
Looking around in the source code, I found this method:
def check_name
self.firstname = sanitize_name(firstname)
self.lastname = sanitize_name(lastname)
return if firstname.present? && lastname.present?
if (firstname.blank? && lastname.present?) || (firstname.present? && lastname.blank?)
used_name = firstname.presence || lastname
(local_firstname, local_lastname) = User.name_guess(used_name, email)
elsif firstname.blank? && lastname.blank? && email.present?
(local_firstname, loc
Applied test case design: Zammad example
2,031 words