Posts
Manual Testing like a ProTesting
Manual Testing like a ProTesting
Understand the product which you are going to test
- Before you begin testing any app/website, you should know the concepts of the product, what problems the product solves and how are users going to use it.
- Here the steps to rectify the concept of product
- Identifying customer needs.
- Defining the problem and objectives.
- Drafting and analysis.
- Ask for detailed design and drawings.
- Testing.
- Final successful delivery.
Have a clear understanding of requirements
- ‘’First how we know to understand the requirements here the steps mentioned below’’
- There are mainly two types of requirements: 1. Functional 2. Non-functional
- What are Functional Requirements?
- Functional requirements define the basic system behavior. Essentially, they are what the system does or must not do, and can be thought of in terms of how the system responds to inputs. Functional requirements usually define if/then behaviors and include calculations, data input, and business processes.
- What are the Non-Functional Requirements?
- While functional requirements define what the system does or must not do,
- non-functional requirements specify how the system should do it. Non-functional requirements do not affect the basic functionality of the system Even if the non-functional requirements are not met.
- the system will still perform its basic purpose.
Changelog and Impacting Area
- This will help to customize or change the task from the bug
- This will give ease to know the bug
- It will give a glance at the task and the flow in which it is working
- This will help you prioritize where to look for potential bugs
Test Scenario and Cases
- Understand the Learners: To write concrete and effective scenarios you must understand your learners and know their needs and expectations.
- Create Real Life and Relevant Situations: Make your scenarios as real as possible.
- Motivate the Learner: A well-written scenario should motivate the learner to action.
- ‘’How to write the test cases’’
- Title Must be strong
- Include a Strong Description with Assumptions & Preconditions
- Keep the Test Steps Clear and Concise
- The result must be Expected
- Also, Make is Reusable
Critical Flows
- This will ensure, that in case something goes wrong in production, it would be any business-critical flows
- Reason to do: for uncertain changes of code, some regression will occur in code, if we didn't check & deployed in the server.to rid the problem in the product needs to check the critical flow twice.
Don't test along with the developer
- If you test with the developer, you may miss out on edge cases due to the developer's bias or perspective. So make sure you test the app/website once while the developer is not with you.
If in doubt, ask the Developer or Product Lead
- It always helps to communicate any doubt that you have
- As the perspective varies and as well as a method so in case of any doubt ask the developer and correct it.
- Also communicate with the product lead in case of doubt so the better output can be generated of the task with minimal bugs and well-defined task
How to build Pagination with Laravel LivewireLaravel
How to build Pagination with Laravel LivewireLaravel
Livewire is a very awesome thing that I have ever seen, the old school developers are still using the jquery and ajax concept to not refresh the page. But forget the jquery and ajax stuff. If you are good at PHP then you can do the same with Laravel Livewire.
Wait what?
Load dynamic data on the page without using ajax? Yes, it is possible with Laravel Livewire. So that is all about laravel livewire, and in this tutorial, we will see how to build laravel pagination with laravel livewire.
Let's start and I hope you have already set up the livewire. Let's say you already have created a component named UsersListing
Now in the users listing, we want to paginate all users and we will list 10 records per page.
How to use pagination with Laravel Livewire
Livewire provides a trait called WithPagination
and you have to add it into your component UsersListing
. Check out the following code:
use Livewire\WithPagination;
use Livewire\Component;
class UsersListing extends Component
{
use WithPagination;
public function render()
{
return view('livewire.users.index', [ 'users' => User::paginate(10), ]);
}
}
And to load pagination you have to add the following code:
@foreach ($users as $user) ...
@endforeach {{ $users->links() }}
That's it, and your laravel pagination now works like charm without page refresh. There is much more about pagination like how to use it with a custom view, how to use it with a custom theme. We will see it in our next tutorial, until then enjoy the code
How to Keep Your Customers Happy & Increase Repeat ProjectSales
How to Keep Your Customers Happy & Increase Repeat ProjectSales
Introduction
Increasing customer loyalty is a requirement of any organization. If a recurring project is found, the organization develops. Do not require to generate new leads. The cycle of the company runs from the existing customer and scales the company.
1. Keep in touch
Keep in touch with each client every few months to make sure everything goes smoothly. During a class or meeting, ask about your client's challenges. Issues you can resolve. They are more likely to turn to you when they need you.
2. Create high-quality software
One of the best ways to keep customers coming back is to always develop high-quality software. You can do this by meeting the expectations of your customers and also by making sure that they are satisfied with your work. Help your customers save money and get rid of waste, ultimately deliver huge profits for them, and possibly do more business for you.
3. Listen carefully when your customers are speaking to you
Try to give your customers your undivided attention. Multi-tasking is often. When customers are in front of you, make eye contact.
4. Collaborate with clients
To ensure quality in the software you develop and keep your customers happy, you should encourage collaboration with your clients. Meet with them and ask questions so you can fully understand use cases for the software you are developing. Bring new ideas to make suggestions on how to make improvements.
5. Demonstrate time management skills
Tracking time is also key to the success of a project, you should be able to provide detailed reports to your clients for the time spent on their particular projects. They’ll be more likely to hire you again if they see you’re organized and working efficiently.
6. Keep your promises to your customers
When you tell your customer you are going to do something, follow-up as quickly as possible. Given the time frames and honor them.
7. Don’t waste your customers’ time
Everyone is busy. Complicated voice mail systems, making customers repeat their service requests more than once and un-knowledgeable employees are some major time-wasters. A customer’s time is as important as your time!
8. Ask your customers what they want
Constantly ask your customers what you can do for them and how you can do it better. They want extended hours, academic classes, or the ability to talk to the manager. After you ask, try to give them what they want and keep them informed of the process along the way.
We will see more points in our next tutorial.
How to use One Signal in LaravelLaravel
How to use One Signal in LaravelLaravel
The OneSingnal is the market leader in push notification providers. It provides mobile + web push, email & in-app messages, and an easy way to send notifications. OneSignal provides official core PHP APIs but not the Laravel package. We are using OneSignal in many projects and write a bunch of line code in all projects where we needed OneSingnal.
One day I had an idea in my mind why I should not write a Laravel wrapper for OneSignal?. Finally, I wrote the shailesh-ladumor/one-signal Laravel Wrapper for it. Using this package, we can write neat & clean code and just a few lines of code.
OneSignal add this package in his official docs here
You can watch the following video tutorial or follow the article.
This package also works with the previous Laravel version.
Today we are going to see how we can use Laravel OneSignal Wrapper in Laravel. Let's see step by step, how we can do that.
Spet 1: Install Packages
Install shailesh-ladumor/one-signal by the following command,
composer require ladumor/one-signal
Step 2: Publish the config file
Run the following command to publish config file,
php artisan vendor:publish --provider="Ladumor\OneSignal\OneSignalServiceProvider"
Step 3: Add Provider
Add the provider to your config/app.php into the provider section if using a lower version of Laravel,
Ladumor\OneSignal\OneSignalServiceProvider::class
Step 4: Add Facade
Add the Facade to your config/app.php into aliases section,
'OneSignal' => \Ladumor\OneSignal\OneSignal::class
Configure a .env file with following keys
ONE_SIGNAL_APP_ID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
ONE_SIGNAL_AUTHORIZE=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X
ONE_SIGNAL_AUTH_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ONE_SIGNAL_AUTH_KEY
is optional if you do not want to create an app. I hope you are familiar with the One Signal Platform and know how to get APP_ID and AUTHORIZE. If not, you should see the below image for how to get it.
So, we are done. Let's check how to send push notifications.
Check out this code to send a push notification.
use Ladumor\OneSignal\OneSignal;
$fields['include_player_ids'] = ['xxxxxxxx-xxxx-xxx-xxxx-yyyyy']
$message = 'hey!! This is a test push.!' OneSignal::sendPush($fields, $message);
How To Change Background in PhotoshopDesign
How To Change Background in PhotoshopDesign
Step:1 Create a new artboard
Step:2 Set Image In artboard
Step:3 Select cropping portion of the image
Step:4 Select Refine edge
- Set radius 1 to 2 px
- Increase smooth 6 to 7 px from global refinements
- Set contrast 20% in global refinements
- Check to decontaminate colors in output settings and set amount 70%
- Set new layer with a layer mask in output dropdown
Step 5: set new background
How to use AdminLTE theme with Laravel FortifyLaravel
How to use AdminLTE theme with Laravel FortifyLaravel
Recently, the Laravel team announced a Laravel Fortify. A framework agnostic authentication backend for Laravel applications. It provides registration, authentication along with two-factor authentication.
As said above, it is framework agnostic, so it doesn't provide any blade views with it. You can implement views of your choice of the frontend. Blade, Vue, React with Bootstrap or TailwindCSS, or any other CSS framework.
Today we are going to see how we can use Laravel Fortify with one of the most popular Bootstrap 4 theme AdminLTE v3.
We can actually do that in minutes with the package that we already developed called Laravel UI AdminLTE
This package also works with the previous laravel version to have an authentication system with Laravel UI for Laravel Frontend Scaffolding.
Let's see step by step, how we can do that.
Install Packages
Install Laravel Fortify and Laravel UI AdminLTE by the following command,
composer require laravel/fortify infyomlabs/laravel-ui-adminlte
Publish Fortify Resources
This command will publish all required actions in the app/Actions directory along with the Fortify configuration file and migration for two-factor authentication.
php artisan vendor:publish --provider="Laravel\Fortify\FortifyServiceProvider"
Run Migrations
Then run migrations,
php artisan migrate
Add Fortify Service Provider
Next step, add published FortifyServiceProvider to config/app.php
Run AdminLTE Fortify Command
Run the following command,
php artisan ui adminlte-fortify --auth
Install Node Modules and Run a Build
As a next step, install required npm modules and run a build,
npm install && npm run dev
And we are done. Now visit the home page and you should be able to see the full authentication system working including,
Login Registration Forgot Password Reset Password Home page
Laravel AdminLTE UI also provides a starting layout with a sidebar menu and header once you login. so you are all set to go.
Retrieve count of nested relationship data in LaravelLaravel
Retrieve count of nested relationship data in LaravelLaravel
Recently in one of our client's projects, we want to load the count of relation in laravel. But we do not want to retrieve original records.
For example,
We have the following Models,
- Category
- Products
- Orders
For that, we have categories
, products
, orders
, order_items
table. Where in the order_items
table, we got the following fields
- order_id
- product_id
- quantity
So the requirement was, In the Products table, we want to display the total number of orders placed with that item regardless of the quantity in each order. All we need is a number of orders where the product is purchased.
1st way: Query via Relationship
$products = Product::all();
$productsArr = $products->map(function (Product $product)
{
$productObj = $product->toArray();
$productObj['orders_count'] = $product->orders()->count();
return $productObj;
}
);
But the problem with this approach was, we are firing queries to the database for every single product. so if I'm retrieving 100 Products from the database then it will fire 100 additional queries to the database. Imagine if we have thousands of products.
2nd way: Eager Load Relationship and Calculate Count
$products = Product::with('orders')->get();
$productsArr = $products->map(function (Product $product)
{
$productObj = $product->toArray();
$productObj['orders_count'] = $product->orders->count();
return $productObj;
}
);
so this way, we are only firing two queries to the database. But the problem here is, we are loading all the Orders of each product which we don't need at all. so it will consume lots of memory since we are loading lots of orders. so imaging if we retrieve 100 products, and each product has 10 orders, then we are loading 1000 Orders into memory without any need.
3rd way: Use withCount function
The third powerful approach of using withCount
function in Laravel. so we refactored our code like,
$products = Product::withCount('orders')->get();
$productsArr = $products->map(function (Product $product)
{
$productObj = $product->toArray();
$productObj['orders_count'] = $product ->getAttribute('orders_count');
return $productObj;
}
);
In this approach, we are firing two queries but no Order models are loaded into memory.
4th Bonus: Using in a nested relationship while multiple eager loading
You can even use it with nested relationships. Imagine a case, where you want to retrieve categories along with its products with orders count.
$categories = Category::with(['products' => function ($query)
{
$query->withCount('orders');
},
'someOtherEagerLoading1',
'someOtherEagerLoading2'
])->get();
$categoriesArr = $categories->map(function (Category $category)
{
$categoryObj = $category->toArray();
$categoryObj['products'] = $category->products->map(function (Product $product)
{
$productObj = $product->toArray();
$productObj['orders_count'] = $product ->getAttribute('orders_count');
return $productObj;
});
return $categoryObj;
});
Hope this will help you to retrieve the count of relationship data without retrieving actual relation data.
Laravel Packages we use everyday at InfyOmLaravel
Laravel Packages we use everyday at InfyOmLaravel
Lots of people ask me frequently, "Which are the laravel packages that you use in almost all projects?" when we meet in Meetup or any other events regardless of its online or physical events.
Let me describe today some of the packages that we almost use in all of the projects.
We have been working in Laravel for almost 7+ years and in these years we have used lots of packages, some from the community and some of our own.
I am categorizing these into 2 categories.
- Most used packages
- Common Need/Functionality specific packages
Most used packages
These are the packages which must be included in all of our projects. No Excuses.
barryvdh/laravel-ide-helper
Laravel exposes a lot of magic methods and properties. IDE Helper is a very good package when it comes to auto-complete those properties and methods. Even it does an amazing job while refactoring properties or methods of the model.
barryvdh/laravel-debugbar
The second one is from the same author, debugbar helps to debug the request in terms of the number of queries fired, time taken by each query, number models retrieved from db, time taken by each request, and much more.
imanghafoori/laravel-microscope
Laravel Microscope improves the readability of your code. Early returns, unnecessary else statements, and many more. so your code looks clean and efficient in terms of execution as well.
beyondcode/laravel-query-detector
One of the problems that we face is, missing eager loading. In ongoing development, sometimes we add relationships objects in the loops, and then laravel fires tons of queries to the database. Laravel Query Detector detects that and gives a warning while developing the environment.
InfyOmLabs/laravel-generator
No application can be ever built without a few CRUDs. CRUDs are essential in almost all web applications. Also, APIs of CRUDs are essential while building a backend for Mobile or Frontend apps. Laravel Generator is our own developed package that we use in all of the applications to make the CRUD building process faster. It can be used with two themes right now, AdminLTE and CoreUI. But it's also frontend framework agnostic.
Common Need/Functionality specific packages
These are the packages that are used when we particularly need that kind of functionality in the application.
- Single Page application without JS - Livewire
- Role Permissions - spatie/laravel-permission
- Media Management - spatie/laravel-medialibrary
- Full Text Search - Laravel Scout
- Payment - Laravel Cashier
- Frontend Scaffolding - Laravel UI AdminLTE & Laravel UI CoreUI
- APIs token management - Laravel Sanctum
- Realtime Apps - Laravel Echo with Pusher & Laravel Echo Server
- One Signal - Shailesh OneSignal
Will keep this list updating.