Index
Check Validation Rules
Apply Client-Side and Server-Side Validation
Check Length and Content
Meaningful Success Messages
Dynamic Messages from JSON Data
Route Redirection
Dynamic Form Handling
Test File Uploads
Cross-Browser Compatibility Testing
Mobile Responsiveness
Testing User Roles and Permissions
Localization Testing
Testing Browser Back/Forward Navigation
Data Sorting and Filtering
Testing Email Notifications
Testing Timezone Handling
Testing Error Handling(500,404,401,403)
Testing Session Expiry
Testing Concurrent User Sessions
Check Validation Rules
:
Identify input fields that are compulsory or optional based on domain knowledge and requirements follow validation rules.
Sample Validation rules in Laravel Controller
$validatedData = $request->validate([
'compulsory_field' => 'required',
'optional_field' => 'sometimes',
// Add other validation rules as needed
]);
Apply Client-Side and Server-Side Validation
:
Implement client-side validation using jQuery
.
Validate data on the server side to ensure security
.
// jQuery Client-Side Validation
$('#form_id').submit(function () {
// Validate using jQuery
// ...
// Server-Side Validation in Laravel Controller
// ...
});
Check Length and Content
:
Verify the length of the description field for both long and short descriptions
.
Ensure proper display of images and links in the view page
.
// Check Description Length
let descriptionLength = $('#description').val().length;
// Check if Image and Link are Present
if ($('#image').attr('src') && $('#link').attr('href')) {
// Valid image and link
}
Meaningful Success Messages
:
Display meaningful success messages after saving data
.
Use jQuery to show/hide messages, possibly in a modal popup
.
return redirect('/success')->with('success', 'Data saved successfully');
// jQuery to Show/Hide Modal Popup
$('#successModal').modal('show');
Dynamic Messages from JSON Data
dynamic message gives more flexibility to end users,there are different way to add dynamic message with best practices
Add dynamic message using variables in the form after storing data on the server side
.
Display dynamic messages retrieved from JSON data
.
$dynamicMessage = json_decode('{"message": "Dynamic message"}');
return view('form')->with('dynamicMessage', $dynamicMessage->message);
Route Redirection
Check proper route redirection after storing data or button click.
.
Ensure the redirection aligns with user expectations
// Redirect after Saving Data
return redirect('/dashboard');
Dynamic Form Handling
to give more flexibility to end user u can add dynamic input fields and handle dynamic form using jquery
Add dynamic input fields based on dropdown, radio button, or checkbox selections
.
Use jQuery to dynamically update the form based on user interactions
.
// Dynamic Input Field based on Dropdown Selection
$('#dropdown').change(function () {
// Add or remove input fields dynamically
// ...
});
These steps cover various aspects of manual testing with coding examples in Laravel, jQuery, JavaScript, and JSON, providing a comprehensive approach to ensure the functionality and user experience of the form.
Test File Uploads
Verify file upload functionality
.
Check if the correct file types and sizes are allowed
.
// Laravel File Upload Validation
$validatedData = $request->validate([
'file' => 'required|file|mimes:jpeg,png,pdf|max:2048',
]);
Cross-Browser Compatibility Testing
Test the application on different browsers to ensure compatibility
.
Address any inconsistencies in rendering or functionality
.
No specific code example, but use browser testing tools or services
.
Mobile Responsiveness:
Check the responsiveness of the application on various devices
.
Ensure the layout adjusts appropriately for different screen sizes
.
No specific code example, but use responsive design principles
.
Testing User Roles and Permissions
Test different user roles (e.g., admin, regular user) to ensure proper access control
.
Verify that users can perform actions according to their assigned roles
.
// Laravel Middleware for Admin Access
public function handle($request, Closure $next)
{
if (auth()->user()->role == 'admin') {
return $next($request);
}
return redirect('/home')->with('error', 'Unauthorized access');
}
Localization Testing
Test the application in multiple languages to ensure correct translations
.
Verify that date formats, currency symbols, and other localized elements are accurate
.
// Laravel Blade Template for Localization
{{ __('messages.welcome') }}
Testing Browser Back/Forward Navigation
Check if the application handles browser back and forward buttons appropriately
.
Ensure that users don't encounter unexpected behavior or data loss
.
No specific code example, but validate using browser navigation
.
Data Sorting and Filtering:
Test the sorting and filtering functionality for tables and lists
.
Verify that data is displayed correctly based on user-selected criteria
.
// Laravel Query Builder for Sorting
$users = DB::table('users')
->orderBy('name', 'asc')
->get();
Testing Email Notifications
Test email notifications to verify content, formatting, and delivery
.
Check if email links and buttons work as expected
.
No specific code example, but monitor email logs during testing
.
Testing Timezone Handling
Test the application's behavior with different time zones
.
Verify that date and time calculations are accurate across time zones
.
config(['app.timezone' => 'UTC']);
Check the responsiveness of the application on various devices
.
Ensure the layout adjusts appropriately for different screen sizes
.
No specific code example, but use responsive design principles
.
Testing Error Handling(500,404,401,403)
following testing and status error explained below
500 Internal Server Error
Simulate scenarios that could lead to a server error (e.g., database connection issues)
.
Verify that a user-friendly error page is displayed instead of exposing technical details
// Laravel Exception Handler
public function render($request, Throwable $exception)
{
if ($exception instanceof \Exception) {
return response()->view('errors.custom', [], 500);
}
return parent::render($request, $exception);
}
Output: Ensure that a custom error page is displayed to the user with a friendly message, avoiding the exposure of sensitive details
404 Error
Access invalid URLs or pages to trigger a 404 error
.
Confirm that a user-friendly 404 page is presented, guiding users to relevant sections
.
Coding Example (Laravel Custom 404 Page):
public function boot()
{
parent::boot();
// Custom 404 Page
\Route::fallback(function () {
return view('errors.404');
});
}
Output: Ensure that a custom 404 error page is displayed, providing helpful information and navigation options
.
Testing Unauthorized Access (401 Error)
:
Attempt to access restricted areas without proper authentication
.
Verify that users are redirected to the login page or presented with a 401 unauthorized error
.
Coding Example (Laravel Middleware for Authentication):
public function handle($request, Closure $next)
{
if (!auth()->check()) {
abort(401, 'Unauthorized access');
}
return $next($request);
}
Output: Confirm that unauthorized access results in the expected error response, guiding users to proper authentication.
Testing Forbidden Access (403 Error):
Test accessing areas with insufficient permissions
.
Ensure that users receive a 403 forbidden error or are redirected appropriately
.
Coding Example (Laravel Middleware for Authorization):
public function handle($request, Closure $next)
{
if (!auth()->user()->can('access-admin-panel')) {
abort(403, 'Forbidden access');
}
return $next($request);
}
Output: Verify that attempting to access forbidden areas results in the expected error response, guiding users accordingly.
Testing Redirection After Logout
Logout and check if users are redirected to the expected page
.
Ensure users cannot access restricted pages after logout
.
Coding Example (Laravel Logout Redirect):
public function logout(Request $request)
{
$this->guard()->logout();
$request->session()->invalidate();
return $this->loggedOut($request) ?: redirect('/home');
}
Output: Confirm that users are redirected to the designated page after successful logout.
Testing Session Expiry
Simulate a scenario where the user's session expires
.
Verify that users are prompted to re-authenticate and don't encounter unexpected errors
.
Coding Example (Laravel Session Configuration):
'lifetime' => 120, // Session lifetime in minutes
'expire_on_close' => true, // Expire session on browser close
Output: Ensure users are prompted to re-authenticate when their session expires, and the application gracefully handles session-related errors.
Testing Concurrent User Sessions
Attempt to log in with the same user credentials from multiple devices.
Confirm that the application handles concurrent sessions appropriately, avoiding conflicts or unexpected behavior
.
No specific code example, but ensure the authentication system is configured to handle concurrent sessions securely
.
Top comments (0)