Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic concept of out unit tests
#1
OK, so we have the test repository where Joe explained how you can set up the test repository in your development installation and how you should execute the unit tests. Those unit tests start at the phpunit.xml file and collect all files in the directories mentioned I presume? Then it executes all the methods of all the classes Each class should extend the TestCase class.

I want to write a blogpost about this after writing some tests myself. What I want to know is, what do we want to do here? Is there a certain guideline for the directories and files? Do we want to write tests of which we know they should pass or do we want to test known bugs so we can remind ourselves of what we still need to fix?

Is there any other etiquette that I should know of?
Reply
#2
Quote:what do we want to do here?

My current goal is to create unit tests for as much of the application as we can.


Quote:Is there a certain guideline for the directories and files?

Yes, following testing recommendations, each test should live in the exact same place as the soruce file it is testing, with the same name but ended in "Test". For example,

modules/com_vtiger_workflow/VTSimpleTemplateTest.php

contains tests for:

modules/com_vtiger_workflow/VTSimpleTemplate.php


Quote:Do we want to write tests of which we know they should pass or do we want to test known bugs so we can remind ourselves of what we still need to fix?

write tests that should pass. the idea is that the current set of tests should pass against the test database, so we can "prove" that the changes we make don't break existing functionality


Quote:Is there any other etiquette that I should know of?

no, just apply the same code formatting we follow in the code and keep the dialog open so we don't overlap each other's work
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)