Replies: 3 comments
-
I think this is the right way to go. We will just have to do the test here and there. I hope we can do portions of the test and not the hole thing so we can test portions of the component without testing the howl thing. |
Beta Was this translation helpful? Give feedback.
-
Ok, well, if we can set up Travis-ci correctly, I think we can have it so that the tests are run for every commit automatically when pulled to github. That would mean that 'phing build' would no longer include the unit tests. |
Beta Was this translation helpful? Give feedback.
-
I'm fine with that. On Fri, Mar 29, 2013 at 11:22 AM, Eugen Istoc [email protected]:
Thanks, |
Beta Was this translation helpful? Give feedback.
-
As I've been studying the best way to start incorporating tests in the component as described here, here is what I've learned:
Two types of tests
Unit Test
In Joomla, Unit Tests are used only for testing library specific code that can be compartmentalized, and tested as single atomic units.
In the case of JBS, we'll need to identify parts of the component that we can test individually. Most of the methods in the component rely on the joomla framework to do the work.
Perhaps, we begin to test areas of the component that we can strictly provide input and assert the output. The first area that comes to mind are the classes in
admin/helpers
.I'm still yet to figure out if we can apply functional unit tests to other areas like the component models, controllers, or views.
System Tests
As mentioned in the Joomla documentation, systems tests are used to test the joomla cms from the point of view of a user. These pretty much launch a firefox and automate user clicks, and assert various parts of a rendered page for correctness.
I was able to create mock test, which tests the JBS component installation, so this is certainly a good way to test the component.
The only drawback of system tests is that they tend to take longer to run.
The joomla approach is to have both Unit Tests and System tests. They're just used for different purposes. Unit tests are used for testing the framwork, and system tests for testing the over all system.
We can take a similar approach for JBS and focus on System tests for testing the component inside joomla, and unit tests for testing component specific functionality.
Is this a good approach?
Beta Was this translation helpful? Give feedback.
All reactions