The process of testing should be a major element of your testing process whether you are offering premium or free themes. By encouraging these testing techniques you can detect the possible defects and prevent the occurrence of others.
Through this post, I am sharing with you some tips and tools which I myself use in order to get a bug free product. For better understanding I have split the article into three categories i.e. setting up, Development and final testing. Thus will help you understand the whole cycle in a step by step manner and get a better overview of how to test your wordpress theme.
Setting up
Setting up a perfect environment can greatly help you in preventive bugs and detecting them easily.
- Use of Network (WordPress multisite): Developing for a network installation with plug-ins is slightly different. I prefer using one network for the themes which I make ensuring that themes work properly on the network installations also.
- Customized table prefix: Using the custom table prefix will help you in two ways. Firstly, it shall ensure that you don’t hardcode the queries of the database and secondly, it will give you some extra security by using prefixes.
- Allow debugging information: Many developers leave the variables undefined which could lead to other problems at later stages. Make sure you do not accidently trigger notices y checking out your configurations.
- Disable WordPress script concatenation: Disabling the script concatenation is function not known to many. To have a look on how things in wordpress work, you can make use of the JavaScript files. Also you should enable the script concatenation for production environments.
- Advanced query: A bit of coding in wordpress like define (‘SAVEQUERIES’, true); constant in wp-config.php, will save all the queries you perform in a variable.
- Disabling Trash: It is a helpful feature that will remove your trash as you develop, create and delete pages or posts. This can be done by define (‘EMPTY_TRASH_DAYS’, 0); in wp-config.php.
- Testing of post: You can also import the test content form the Theme Unit Test. This test suite shall contain normal posts, no title posts, no content posts, no image posts, posts with numerous categories and much more. This will help you test the fringe case which is considered critical for all types of themes.
DEVELOPMENT
Just Do It Now
Many coders first work on major features and then resort to touch up the details. This is one of the worst practices ever as you often tend to forget things which results in your code becoming muddled up. This will result in a chaos in your mind as you are left with codes and bugs scattered all around you. In this case what I recommend you is to decide before hand if you wish to develop a feature or not. Once decided, you need to make sure that you do not leave them in the middle by thinking that these are satisfactory as of now and can be fixed later.
Follow Modularity
To develop in an effective and efficient manner just makes sure you follow lessons of object oriented PHP. Following the general philosophy can be quite helpful. The wordpress widgets are a great example as you can create a backend form for a widget and ensure that the data is being saved properly and then add the front end code. This will help the widget work anytime, anywhere.
Making Use of the Right tools
You can speed up the development process by using appropriate tools.
Here is a list of some great development tools which shall substantially make your things faster, better and smarter.
1. LESS
Tools like LESS or Sass are characteristic tools that are used by almost every one. Although these tools have some intricacies, the benefits attached to them are way more. It is the preference of the people which determines the use of this tool.
2. Codekit
Codekit is an expedient tool that compiles LESS to wherever you want. It concatenates JavaScript files checks the syntax and does myriads of other stuff that can make your work easier. There are numerous other alternatives for Codekit but based on my own preference I find neither of them as helpful as Codekit.
3. Snippets
Snippets are widely used for printing a variable or outputting a long comment. I personally have saved a lot of time by using it and recommend others as well.
4. Switching Users
As you test different accounts to ensure that users get access to what they are suppose to get, especially when you have a role specific environment, you will find User Switching a boon. It enables you to switch between different accounts through a single click and make things amazingly easier.
5. Browser development tools
Using the browser development tools will help you in achieving faster and better performance. You can easily fix CSS problems by look up styles and accessing the DOM becomes easy. The Ajax response and JavaScript debugger will help you with respective debugging.
Final Testing
Just when you are done with all the major development process, there will come a time where you will realize that actually what have you done till now. The real work starts with the final testing where even petty issues sum up to become a giant headache. Here are some tricks and tools below which shall help you in reducing bugs and give you some wisdom to deal with them.
WordPress Theme check
The WordPress Theme Check (maintained by WordPress’ own developers) is an outstanding tool which ensures that your theme is as per the specification. Suppose you submit a theme on theme forest, they by making use of this will brutally reject it upon encountering errors. This tool checks incorrect text domains, specified functions ad attributes, legacy functions, hidden files etc. This effective plug-in makes your theme 100% compliant to wordpress.
Cloudapp and Fluffyapp
If you look to upload files without much of a hassle, CloudApp is a service for it. On MAC you can just press Shift + Control + Command + 4
for a screen shot and then instantly press Control + Option + C
and then wait for a “ping,” which indicates that the screenshot has been uploaded. You can then paste it in an email, chat or issue tracker. For window user’s FluffyApp is the best alternative.
Good Documentation
Documentation is often not related to testing directly but it is an outstanding way of testing a website. By writing documentation you can easily go through the features of the website and ensure that they work. The documentation generator can be used with all our themes and also generates a beautiful format which lessens our work.
Get More Views
We all are different which means that we all think differently and also use things in a different manner. A great way of testing your theme is to sit with users and watch as they test your theme in their own way. This will result in a different thought process coming into picture and also help you to see from a wider perspective. The feature that may be obvious for you may seem to be confusing for a user.
Video Presentation
This will help you to find and catch the minute things which need to be corrected. Since it is the video which gives a first impression about your theme, you will do some real brainstorming to get it right. This power to stop and play at your on the convenience will help you discover more bugs and discrepancies.
Conclusion
I hope the viewers of this post found it helpful and would adopt these tips and tricks which will in turn make things a lot easier for you. Your comments and suggestions on this post will be more than welcome.
View Comments