Skip to content

Clean up Zenmap unit tests #85

Description

@dmiller-nmap

Lots of Zenmap's component Python modules have unit tests of some sort or other, but many are just "run this function if __name__=='__main__'" type of things. We currently use the test discovery built in to Python 2.7's unittest library, so this task could be taken in a few different steps:

  1. Convert existing tests to unittest test cases so that autodiscovery can pick them up.
  2. Add new test cases for functions and modules not covered by any tests.
  3. Use a more robust testing structure (like a zenmap/tests/ directory) so we don't rely on autodiscovery, which doesn't work on Python 2.6 and earlier.

Activity

  1. Amertz08 commented on Mar 26, 2015

    @Amertz08

    I'd like to work on this for the SoC2015. My questions being given a full-time commitment to this how long would something like this take?

    Is there a list of all the functions and modules categorized into either your step 1 or step 2 categories?

    Where are the current unittest located?

  2. dmiller-nmap commented on Mar 27, 2015

    @dmiller-nmap
    Author

    @Amertz08 I would anticipate that this would take about 2 or 3 weeks of full-time work, but I'm a bad estimator of other people's time budgets. The modules are in the zenmap/ directory under zenmapGUI, zenmapCore, and radialnet. The existing unittest-compatible tests are discovered and run with zenmap/tests/run_tests.py.

  3. berdario commented on May 5, 2015

    @berdario

    Not very useful, but I got this failure

    Traceback (most recent call last):
      File "run_tests.py", line 15, in <module>
        start_dir=glob.glob("build/lib.*")[0],
    IndexError: list index out of range
    make: *** [zenmap_check] Error 1
    

    The problem is that the build directory doesn't exist.
    Assuming that zenmap isn't enabled by default, I didn't configure to build it (that is, my configure command was just ./configure --with-libpcap=included). I have both python (Python2) and python3 executables on my system

  4. RajithaRama commented on Aug 3, 2016

    @RajithaRama

    @dmiller-nmap I like to work on this. Not fulltime. But when i have time i will do it. It's ok to use PyUnit for this write..?

  5. mohzah commented on Mar 28, 2017

    @mohzah

    @berdario probably too late to reply but may be useful for someone else
    build directory will be created if you run python setup.py install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions