Juli Goes
Juli Goes30/11/2023 19:52
Compartilhe

Testing Technique - Equivalence Partitioning (english version)

    Hey Everyone,

    Because the Introduction to Testing course (Dio.IO) gives us a glimpse into the testing field, I decided to share with you a practical testing technique, which is the Equivalence Partitioning technique, a type of black-box testing.

    What is it? It is a technique used to generate test cases focused on business rules.

    And yes, to generate test cases, it is not necessary for the testing professional to have only creativity. I know that at the beginning of the profession, many don't have enough technical knowledge and generate numerous cases without a specific focus. Yes, it's part of the learning process; it happened to me, and it can happen to others who are starting. However, we have techniques that help us generate test scenarios and even justify why they were generated.

    So let's go - What is equivalence partitioning (ISTQB concept)?

    **Equivalence Partitioning:**

    Subset of the value domain of a variable within a component or system for which, based on the specification, it is assumed that all values should be treated the same way.

    Did you understand the concept? I think some might read and say, "What?"

    Basically, it informs us that we have a set of variables, and we can divide them into partitions based on the specification of the specified business rule, treating all parts equally.

    But let's understand how to do it in practice.

    Let's suppose you have a college system, and now, on Black Friday, they are going to offer a discount promotion for alumni.

    Business rule - Alumni who re-enroll during the Black Friday promotion will receive a 30% discount on tuition for the entire chosen course.

    **Step 1 -** First, let's choose the variables that should be tested.

    In this case, we can divide it into a True or False boolean question.

    Is the enrolling person an alum?

    ______________YES____________________ |______________ NO __________

    So what would be the input variable?

    The system has a registration of full name and CPF, and in this rule, the chosen validator is CPF.

    So we have the Entry variable = CPF

    Expected return Yes or No (Remember our question)

    So what cases could we generate to validate this rule?

    1 - CPF of an alum

    2 - CPF of a new student

    Are these two cases sufficient to validate whether the rule was applied or not?

    Think about it...

    In theory, yes, because we would have the validation of the expected returns in the rule. However, we still need to define what the invalid cases might be that could occur during this registration.

    **Step 2 -** Now let's divide into valid and invalid returns:

    __________________Invalid _________ | ________ Valid (Boolean Yes/No)_____________

    What could be an invalid case?

    1 - An invalid CPF;

    2 - Fill out a registration and not provide the CPF (blank);

    So far, we have four different scenarios for testing:

    1 - CPF of an alum

    2 - CPF of a new student

    3 - An invalid CPF

    4 - Fill out a registration and not provide the CPF

    ______Invalid (Invalid CPF and blank) ____ | ________ Valid (Yes/No)_____________

    Would these four cases validate the business rule?

    If the answer is YES...

    We don't need to generate countless test cases to validate the rule.

    See that so far, we haven't used the application, haven't used any tools; you can do this using just a sheet of paper and a pen.

    Simple, right?

    And even at this point, you can think of other validations to discuss with the Project Product Owner or Requirements Analyst, such as:

    - If a person enrolls in more than one course, will they get the same discount on both?

    - If a current student enrolls, will they get any kind of discount?

    - Can an alum with a debt to the college register with a discount?

    - If an alum with pending subjects enrolls in a postgraduate course, will they get the discount? Will the system allow enrollment?

    - Is there a time limit for alumni to get this discount, for example, alumni with more than 10 years since the last course?

    - Is there any rule for losing this discount during the course? For example, non-payment, not completing subjects within the semester?

    - Is there a rule for the payment date of the enrollment itself to still retain the discount, for example, within a week of enrollment?

    - Does the discount date only apply on Black Friday or during a week or a month? What are the limits (this answer would provide a new equivalence partition for this rule).

    What you can do first is check the documentation itself to see if there is an item that already answers some of these questions. If not, or if there is any ambiguity, it's worth asking the Project Product Owner.

    These questions contribute to the application, and these questions should not be asked by customers at the time of enrollment. One of the QA roles is also to analyze business rules, their impacts, and coverage; this improves application quality.

    I hope that in some way, I have been able to explain this method to you.

    Try it yourself; take a business rule and draw this, it's a good exercise to start thinking about test scenarios.

    If

     you have any doubts, I am at your disposal!

    See you later,

    Juli

    Compartilhe
    Comentários (0)