Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft: update description of drafttests package
- Loading branch information
1 parent
fee81e8
commit e39c45d
Showing
2 changed files
with
75 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,53 @@ | ||
2020 February | ||
# General | ||
|
||
2020 May | ||
|
||
These files provide the unit tests classes based on the standard Python | ||
`unittest` module. | ||
|
||
These files should be imported from the main `TestDraft.py` module | ||
which is the one registered in the program in `InitGui.py`. | ||
These files should be imported from the main `TestDraft.py` | ||
and `TestDraftGui.py` modules which are registered in the program | ||
in `Init.py` and `InitGui.py` depending on if they require | ||
the graphical interface or not. | ||
|
||
Each module should define a class derived from `unittest.TestCase`, | ||
and the individual methods of the class correspond to the individual | ||
unit tests which try a specific function in the workbench. | ||
|
||
The tests should be callable from the terminal. | ||
```bash | ||
# All tests that don't require the graphical interface | ||
program --console -t TestDraft | ||
|
||
# Only creation tests | ||
program --console -t drafttests.test_creation | ||
|
||
# A specific test inside a module and class | ||
program --console -t drafttests.test_creation.DraftCreation.test_line | ||
``` | ||
program -t TestDraft # all tests | ||
program -t drafttests.test_creation # only creation functions | ||
|
||
# A specific test | ||
program -t drafttests.test_creation.DraftCreation.test_line | ||
Where `program` is the name of the FreeCAD executable. | ||
|
||
Most tests should be designed to pass even without the graphical interface, | ||
meaning that they should run in console mode. | ||
|
||
The exception to this are particular tests that explicitly use | ||
the graphical interface. | ||
```bash | ||
# All tests that require the graphical interface | ||
program -t TestDraftGui | ||
``` | ||
|
||
For more information see the thread: | ||
[New unit tests for Draft Workbench](https://forum.freecadweb.org/viewtopic.php?f=23&t=40405) | ||
|
||
# To do | ||
|
||
Not every single function in the workbench is tested, so new unit tests | ||
can be written. This will improve reliability of the workbench, | ||
making it easier to discover bugs and regressions. | ||
|
||
See the individual modules to check what is missing. | ||
|
||
In particular, unit tests for the import and export modules (SVG, DXF, DWG) | ||
are required. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,41 @@ | ||
"""Classes and functions used to test the workbench. | ||
# *************************************************************************** | ||
# * (c) 2019 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> * | ||
# * * | ||
# * This file is part of the FreeCAD CAx development system. * | ||
# * * | ||
# * This program is free software; you can redistribute it and/or modify * | ||
# * it under the terms of the GNU Lesser General Public License (LGPL) * | ||
# * as published by the Free Software Foundation; either version 2 of * | ||
# * the License, or (at your option) any later version. * | ||
# * for detail see the LICENCE text file. * | ||
# * * | ||
# * FreeCAD is distributed in the hope that it will be useful, * | ||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
# * GNU Library General Public License for more details. * | ||
# * * | ||
# * You should have received a copy of the GNU Library General Public * | ||
# * License along with FreeCAD; if not, write to the Free Software * | ||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * | ||
# * USA * | ||
# * * | ||
# *************************************************************************** | ||
"""Modules that define classes used for unit testing the workbench. | ||
These classes are called by the unit test launcher | ||
that is defined in `Init.py` and `InitGui.py`. | ||
These modules contain classes and functions that are called | ||
by the unit test module that is defined in `Init.py` and `InitGui.py`. | ||
The unit tests are based on the standard `unittest` module. | ||
The unit tests are placed in separate modules in order to test features | ||
that do not require the graphical user interface (GUI), from those | ||
that do require it. | ||
The unit tests are based on the standard Python `unittest` module. | ||
See this module and `unittest.TestCase` for more information | ||
on how to write unit tests. | ||
:: | ||
class NewTestType(unittest.TestCase): | ||
def test_new_tool(self): | ||
pass | ||
""" |