Most web developers cringe when they hear of TDD (test driven development). Well, I did when I was asked to program with TDD first.

When you are starting off, it feels overwhelming. If you resist it, it will make it harder for you to learn it. So what should you do? Embrace it. Well, it has reason why it is there. There will always be debates on technology, whether the programming language or the process you will use to develop software.

Some may agree that XP or Xtreme Programming is better than TDD and vise-versa. It will really boils down…


You need to start TDD in NodeJS right now! Some asks why? I ask, why not?

I started writing the TDD in Laravel — currently the most famous PHP web framework, with simple instructions on how to start a PHP programmer’s test driven development journey. Now, I would like to share how we can have the same pattern in NodeJs.

In any programming language, test driven development can be really daunting. …


Electron

Building your very first Electron app

Many applications, back in the day, were made with native windows client. A user will just have to click a desktop icon and voila! Ready to use app. Fast track today, most of the applications are already in the “cloud” and is web based.

Web technology for most of the programmers is easier to learn and very fast to develop. When you know the semantics of the html, css and javascript, you would be able to create a stunning website or a web app.

With the delightful experience of programmers around the world using the web technology for creating stunning…


I have been reusing my base repository class for most of my projects. And with every project, I keep on missing new methods I created from the last update. So now, I created a package for it.

I call it: Base Repo Package

Here’s the readme file:


After the articles on unit testing and negative unit testing, let us take a look into Feature testing. These tests are hitting your controllers and asserting if the responses are correct.

I would still use my carousel example from the previous article.

Create carousel feature test

In testing the feature of your application, make sure you segregate the admin UI from the front office UI testing. For my example, I namespace it with Admin and Front

Right now, our focus is the admin panel carousel CRUD. Let’s write the test now.

Let’s break this down a bit.

  • We need the ->actingAs() method to…

As part II of the CRUD Unit Testing in Laravel 5, we continue with negative testing.

What we have in the previous article is testing the positive side; say it CAN create, update, show or delete the carousel we are trying to do.

Now let us test the opposite, what if it fails and how we handle it?

Let us start on the CREATE test.

Remember, when we create our migration file,

we set the link as nullable but the title and the src are NOT NULL.

So, we expect here that the database should throw an error when those columns are null right? …


Recently, I started an open source e-commerce application called LARACOM made with Laravel together with Rob Gloudemans’ shopping cart and other related e-commerce packages.

When starting this project, I have to think of the long term so never in my mind that I will not use the TDD (test driven development) approach, it is a MUST. So in doing it, I need my tests to be separated in two different groups, one for Unit testing and one for Feature testing.

Unit testing is testing your classes — Models, Repositories etc. while Feature testing is testing your code if it hits…


Laravel passport is a great package to authenticate your user to your web or mobile app. It uses the OAuth2 package by phpleague underneath. It should solve most of the API developers problem on the authentication side.

While Laravel Passport is useful to most developers, it is still a puzzle on how to authenticate multiple (user) models within it since underneath(by default), it looks on the users table only.

A recent update on the package allows you to specify a custom provider so you can hack a bit on the framework to look on which table in the database.

Check it out in my Github account — https://github.com/jsdecena/laravel-passport-mutiauth


laravel

Last time, I wrote an article to get your feet wet on Test Driven Development (TDD). You may refer to this post: Simple TDD in Laravel with 11 steps

Today, let us refactor what we have accomplished on that post to make it more manageable. We will use the REPOSITORY pattern. With this way, methods are reusable in the other parts of the application by doing Dependency Injection (DI).

Fork my TDD e-commerce application: https://github.com/jsdecena/laracom (check out the `/tests` folder)

Edit: I created a base repository package that can speed up your development :)

Let’s review the test we have…

Jeff Simons Decena

Senior Fullstack Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store