1
redheadedrod
Unit testing for Xoops - Starting Class project

In my next semester I am taking a class for my engineering degree called Software Quality Assurance. In this class we will be modeling a bunch of unit tests and I would like to try getting my teacher to let me build them for xoops with the hope that I can make significant moves forward to build a full unit test for xoops.

This is a class project for me so it will be somewhat limited at this point but I would like to get some feedback which unit test framework for PHP is the best one to use.

I am over a month away from starting this class yet and I may get stuck working with C# and making unit tests I can't really use but this teacher normally is very flexible for stuff like this and I should be able to get him to budge a little bit on this.

wikipedia has a number of PHP frameworks listed and I saw someone else mention PHPUnit before.

Not to mention I haven't seen much action in the quality assurance area in a while...

2
Mamba
Re: Unit testing for Xoops - Starting Class project
  • 2012/12/7 21:26

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


PHPUnit

You might also take a look at XoopsUnit for xCube:

https://github.com/suin/xoopsunit

for ideas and code.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
redheadedrod
Re: Unit testing for Xoops - Starting Class project

We had a project I finished up on Wed that involved unit testing. Interesting introduction to unit testing.

I MAY start building unit tests for xoops at some point this summer if I have the time and will likely incorporate the tests already done by another user in a different system.

I wonder however if there are code analysis or code coverage tools available too.

With VS 2010 we experienced code coverage that shows how much of the code is tested in our unit tests and code analysis that determines how complex our code is so that we can simplify it.

I was shocked to see the cyclic complexity of a class project I did was 181. You want this under 50 but since we weren't required to bring it under 50 I just noted it. Would be interesting to see how well xoops would do.

4
Mamba
Re: Unit testing for Xoops - Starting Class project
  • 2013/5/4 20:34

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Quote:
I MAY start building unit tests for xoops at some point this summer if I have the time and will likely incorporate the tests already done by another user in a different system.

Alain from France is already looking into it for XOOPS 2.6.0.

Quote:
I wonder however if there are code analysis or code coverage tools available too.

There are more and more tools like these for PHP (e.g. see this link), and we need to use them more in XOOPS development, and in a systematic way.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

5
redheadedrod
Re: Unit testing for Xoops - Starting Class project

Is Alain using PHPunit? I believe he used some other tool previously. It would be a great experience for me to get used to the idea of unit tests. Especially to see something already done since we were JUST introduced to the physical act this past week. Not as much practice with it as I thought.

6
alain91
Re: Unit testing for Xoops - Starting Class project
  • 2013/5/5 13:01

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


Sorry I'm not using PHPUnitbut Simpletest which is more simple to start with as It comes with an builtin tool to run tests from a browser quite easily.

I have made a repository to keep traces of my unit tests.

See next link : http://xoops-unit-test.googlecode.com/svn/trunk/test/

It is simple to translate from simpletest to PHPUnit the test scripts. The most difficult seems form me, to install PHPUnit framework on my computer and to use it.

Just install the files in the Xoops Root with docs, extra and htdocs. And point the browser to test directory.

Nota: One have to install simpletest framework directly from their web site. The version is 1.1.0 in 2010 but is stable and does the expected job. Install in the root xoops directory.

7
alain91
Re: Unit testing for Xoops - Starting Class project
  • 2013/8/16 8:26

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


I'm now been using PHPUNIT for all unit tests.

I have adapted all my previous work to run with PHPUNIT, and I now cover kernel, class and xoops_lib directories.

The next step is to build a continous integration system based on JENKINS.

8
redheadedrod
Re: Unit testing for Xoops - Starting Class project

I will look through what you are doing with your unit testing and may try to build some for the database structure. Another member and I are looking at upgrading the database structure for 2.6 and we are not sure what the testing structure will need to be.

Other than installing PHPUnit is there anything else that needs to be installed to be able to test?

Our initial work is very promising so I would like to try testing some functions shortly.

Thanks for your hard work!

Oh and as it turned out we were only briefly introduced to Unit Tests and Visual Studio does most of the work for you so it wasn't a very good learning experience...

Rodney

Login

Who's Online

252 user(s) are online (172 user(s) are browsing Support Forums)


Members: 0


Guests: 252


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits