[QA-QC] API Testing

Bài giảng


Bài tập


Testcase


Test Description

Step

Expected Result

Actual Result

Note

Username Field

Test create a new user successfully

  1. Enter Username = a non-existed user in Database

  2. Enter both Password and Confirm Password are same

  3. Enter Fullname = character

  4. Enter an valid Email

  5. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test duplicated Username

  1. Enter a existed Username in DB

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: Username existed

 

 

  1. Enter “spaces” in the first and last of the existed user in Database

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: Username existed

 

 

Test empty Username

  1. Enter Usernamr = empty

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Username field is required

 

 

  1. Enter Username = All spaces

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Username field is required

 

 

Test valid maxlength 

  1. Enter Username = 20 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test invalid maxlength

  1. Enter Username = 21 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Username field must be a string with a minimum length of 4 and a maximum length of 20.

 

 

Test valid minlength

  1. Enter Username = 4 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test invalid minlength

  1. Enter Username = 3 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Username field must be a string with a minimum length of 4 and a maximum length of 20.

 

 

Test trimming of space

  1. Enter “spaces” in the first and last of the entered Username

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test Username is Vietnamese

  1. Enter Username is Vietnamese

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The field Username is invalid

 

 

Password Field

Test valid password

  1. Enter both Password and ConfirmPassword are same

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test invalid password

  1. Enter both Password and Confirm Password are not same

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: 'ConfirmPassword' and 'Password' do not match.

 

 

Test empty password

  1. Enter Password = empty

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Password field is required

 

 

  1. Enter Password = all spaces

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Password field is required

 

 

Test valid maxlength 

  1. Enter Username = 20 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test invalid maxlength

  1. Enter Username = 21 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Password field must be a string with a minimum length of 6 and a maximum length of 20

 

 

Test valid minlength

  1. Enter Username = 6 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test invalid minlength

  1. Enter Username = 5 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Password field must be a string with a minimum length of 6 and a maximum length of 20

 

 

Test empty confirm password

  1. Enter ConfirmPassword = empty

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The ConfirmPassword field is required

 

 

  1. Enter ConfirmPassword = all spaces

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The ConfirmPassword field is required

 

 

FullName field

Test valid FullName

  1. Enter FullName = characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test empty FullName

  1. Enter FullName = empty

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The FullName field is required

 

 

  1. Enter FullName = all spaces

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The FullName field is required

 

 

Test valid maxlength 

  1. Enter FullName = 50 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Test invalid maxlength

  1. Enter FullName = 51 characters

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The FullName field must be a string with a maximum length of 50.

 

 

Test trimming of space

  1. Enter “spaces” in the first and last of the entered FullName

  2. Enter the valid data for the remain fields

  3. Click on Send button

    The system displays:
{
    "isSuccess": true,
    "message": "Create successfully",
    "data": {
        "userId": "userID",
        "username": "username",
        "password": "password",
        "confirmPassword": "password",
        "fullName": "FullName",
        "email": "email@gmail.com",
        "activeFlag": true,
        "mustNotChangeFlag": false
    },
    "statusCode": 200
}

 

 

Email Field

Test valid Email

  1. Enter an correct format Email
    eg:demo@cdm.com

  2. Enter the valid data for the remain fields

  3. Click on Send button

The System display

{
"isSuccess": true,
"message": "Create successfully",
"data": {
"userId": "userID",
"username": "username",
"password": "password",
"confirmPassword": "password",
"fullName": "FullName",
"email": "email@gmail.com",
"activeFlag": true,
"mustNotChangeFlag": false
},
"statusCode": 200
}

 

 

Test invalid Email

  1. Enter an Email without/ missing @

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Email field is not a valid e-mail address.

 

 

  1. Enter an Email without/ missing dot (.)

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Email field is not a valid e-mail address.

 

 

  1. Enter an Email without/ missing domain

  2. Enter the valid data for the remain fields

  3. Click on Send button

Status = 400

  • Message: The Email field is not a valid e-mail address.

 

 

  1. Enter an Email name = special chars (!@#$%^&*():"'?/><{}

  2. Enter the valid data for the remain fields

  3. Click on Send button

Status = 400

  • Message: The Email field is not a valid e-mail address.

 

 

  1. Enter an Email name is Vietnamese

  2. Enter the valid data for the remain fields

  3. Click on Send button

Status = 400

  • Message: The Email field is not a valid e-mail address.

 

 

  1. Enter an Email name has middle space

  2. Enter the valid data for the remain fields

  3. Click on Send button

Status = 400

  • Message: The Email field is not a valid e-mail address.

 

 

Test empty Email

  1. Enter Email = Empty

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Email field is required

 

 

  1. Enter Email = all spaces

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: The Email field is required

 

 

Test duplicate Email

  1. Enter an Email existed in DB

  2. Enter the valid data for the remain fields

  3. Click on Send button

  • Status = 400

  • Message: Email existed

 

 

Chi tiết: