[Kstars-devel] Test cases in KStars

Alexey Khudyakov alexey.skladnoy at gmail.com
Sun Oct 30 20:39:30 UTC 2011


On 30.10.2011 23:51, Akarsh Simha wrote:
> Hi
>
> I believe that one of the things that we should have but do not have
> are test cases.
>
Sure. Tests are good and we need more tests. More and more tests.


> I don't know anything about writing test cases, so I'm asking for
> help. I might not be able to implement any of this until vacations in
> December, but I'm just trying to get some ideas about it, and if
> someone wants to go ahead and write some tests, that would be good
> too.
>
Qt have framework for unit tests but I didn't figure out how to 
integrate it with cmake. Does anyone know how to use it?

There is great test framework for haskell - QuickCheck[1]. It does 
property based testing. It tooks properties and tests them by feeding 
them random input. For example length of spatial vector doesn't change 
under rotation and angular distance between point on celestial sphere 
same in equatorial and horizontal coordinates.

In my experience it does great job at exploring obscure corner cases 
which are not covered by unit tests. Sadly only C++ implementation[2]
is incomplete and abandoned. I'll look into it anyway


> KStars is pretty tightly bound, so testing could be a problem, but I
> think a lot of the computational routines can be tested. However, I
> don't know if it is superfluous, for instance, to test things like
> EquatorialToHorizontal, and I don't have much else in mind that can be
> tested.
>
This is one of the reasons why we should write tests. It will force to 
untie different components and classes from each other. It will be 
difficult and painful, but IMHO results worth it. Tests will also 
encourage writing classes with well defined interface which could be tested.

I think it's worthwhile to test EquatorialToHorizontal and similar 
functions. They are not obviously correct and if they do have a bug it 
impacts everything.


> Looking forward to some suggestions and ideas.
>
> Also, Jason used to do a Quality Assurance list before every
> release. The list is somewhat outdated, but that might be a good
> source to look for behaviors to write test cases for:
>
Most of this is test for GUI. Looks like they have to done manually and 
people aren't very keen do such things. Maybe someone knows how to do 
GUI testsing at least semiautomatically?


[1] http://en.wikipedia.org/wiki/QuickCheck
[2] http://software.legiasoft.com/quickcheck/


More information about the Kstars-devel mailing list