Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Making Test Suites | Using a Test Automation Framework
Introduction to QA Automation Testing

bookMaking Test Suites

We have improved the validation functions validateUsername and validatePassword adding the following rules for the username and password respectively:

  • The username should be between 3 and 20 characters in length and it can only contain alphanumeric characters.
  • The password should be at least 8 characters long and it should contain a combination of lower and uppercase letters along with at least one number or symbol;

Your task is to:

  • Organize the test cases present in validation.js Test Script, into appropriate describe blocks.
  • Write test cases to test case code in auth.js. Make sure to enclose the test cases in proper describe blocks;

Following are the test cases you have to write in the __test__/auth.js file:

Test ID: 1

  1. Title: Hash a valid password;
  2. Precondition: The hashPassword function is available;
  3. Test Steps:
    • Pass the string 'examplePassword123' to the hashPassword function;
  4. Expected Result: The function should return a string that is different from the input password;

Test ID: 2

  1. Title: Hash an empty password;
  2. Precondition: The hashPassword function is available;
  3. Test Steps:
    • Pass an empty string '' to the hashPassword function;
  4. Expected Result: The function should return a non-empty string;

Test ID: 3

  1. Title: Compare a valid password with its correct hash;
  2. Precondition: The comparePassword and hashPassword functions are available;
  3. Test Steps:
    • Hash the string 'examplePassword123' using the hashPassword function;
    • Pass the original password 'examplePassword123' and the generated hash to the comparePassword function;
  4. Expected Result: The function should return true, indicating the password matches the hash;

Test ID: 4

  1. Title: Compare a valid password with an incorrect hash;
  2. Precondition: The comparePassword and hashPassword functions are available;
  3. Test Steps:
    • Hash the string 'examplePassword123' using the hashPassword function;
    • Pass a different password 'wrongPassword456' and the generated hash to the comparePassword function;
  4. Expected Result: The function should return false, indicating the password does not match the hash;
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 8

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Awesome!

Completion rate improved to 3.85

bookMaking Test Suites

Deslize para mostrar o menu

We have improved the validation functions validateUsername and validatePassword adding the following rules for the username and password respectively:

  • The username should be between 3 and 20 characters in length and it can only contain alphanumeric characters.
  • The password should be at least 8 characters long and it should contain a combination of lower and uppercase letters along with at least one number or symbol;

Your task is to:

  • Organize the test cases present in validation.js Test Script, into appropriate describe blocks.
  • Write test cases to test case code in auth.js. Make sure to enclose the test cases in proper describe blocks;

Following are the test cases you have to write in the __test__/auth.js file:

Test ID: 1

  1. Title: Hash a valid password;
  2. Precondition: The hashPassword function is available;
  3. Test Steps:
    • Pass the string 'examplePassword123' to the hashPassword function;
  4. Expected Result: The function should return a string that is different from the input password;

Test ID: 2

  1. Title: Hash an empty password;
  2. Precondition: The hashPassword function is available;
  3. Test Steps:
    • Pass an empty string '' to the hashPassword function;
  4. Expected Result: The function should return a non-empty string;

Test ID: 3

  1. Title: Compare a valid password with its correct hash;
  2. Precondition: The comparePassword and hashPassword functions are available;
  3. Test Steps:
    • Hash the string 'examplePassword123' using the hashPassword function;
    • Pass the original password 'examplePassword123' and the generated hash to the comparePassword function;
  4. Expected Result: The function should return true, indicating the password matches the hash;

Test ID: 4

  1. Title: Compare a valid password with an incorrect hash;
  2. Precondition: The comparePassword and hashPassword functions are available;
  3. Test Steps:
    • Hash the string 'examplePassword123' using the hashPassword function;
    • Pass a different password 'wrongPassword456' and the generated hash to the comparePassword function;
  4. Expected Result: The function should return false, indicating the password does not match the hash;
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 8
some-alt