Tag Archives: article

Why people who complain won’t write documentation themselves

Summary: “Too lazy, don’t seriously care, not invested enough, or just simply can’t from the lack of programming experience. Someone else doing the documentation writing can gain a lot from the experience, but advocating someone else to do so is a lost cause.”

Read more »

Possibly Related Posts:


Unit Tests for WordPress

I think for as much coverage as possible the following should be done for encompassing the whole of WordPress using tests. The PHPUnit version 3.2.0 should include many new features that should allow for better testing WordPress in environments more true to XP programming techniques. Along with PHPUnit, I have been meaning to build a site for statistics, but I think it will come later when I have more tests done.

  1. Unit Tests and Characterization Tests.
  2. Hook Tests
  3. Database Tests
  4. Acceptance Tests

Unit Tests and Characterization Tests

There aren’t very many functions or library files that allow for true Unit Testing, so I would rather combine the two tests, instead of trying to keep them separate. This would allow for coders writing tests to not worry about whether the function can be unit tested or have characterization tests. Comments should be made for the methods on what is tested to let others know if the test is an unit test or characterization test to the knowledge of the author.

All actions and filters will have to be disabled while running the tests to allow for just testing the functions. Testing the hooks would be done separately. Looking through some of the bug reports, it seems that some hooks are required to test for some obscure bugs. This should be done in the next section.

The unit tests and characterizations tests should be run by themselves, separate in execution from the rest of the tests. I have also been meaning to remove dependencies on my changes. I think that since the last WordPress commit, that is no longer an issue.

Hook Tests

Remove all filters and actions and manually add the hook workflow to test the result. This would require mock functions that duplicate the functions or running the full version of WordPress, except for the output.

Testing the hooks has more to do with regressions and refactoring of hooks, since hooks should work as long as the plugin test passes.

Database Tests

PHPUnit 3.2.0 will include DBUnit which will allow using a snapshot of the database and test output using that instead of a real database. This should be extremely helpful in testing Database Queries.

Acceptance Tests

Test the blog site to make sure that everything appears correctly.

Possibly Related Posts: