Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Praxishasen Bericht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Jan Wille
Praxishasen Bericht
Commits
94caf581
Commit
94caf581
authored
3 years ago
by
Jan Wille
Browse files
Options
Downloads
Patches
Plain Diff
section Testen
parent
a477d414
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.vscode/ltex.dictionary.de-DE.txt
+1
-0
1 addition, 0 deletions
.vscode/ltex.dictionary.de-DE.txt
Praxisbericht.pdf
+0
-0
0 additions, 0 deletions
Praxisbericht.pdf
Praxisbericht.tex
+24
-0
24 additions, 0 deletions
Praxisbericht.tex
with
25 additions
and
0 deletions
.vscode/ltex.dictionary.de-DE.txt
+
1
−
0
View file @
94caf581
...
...
@@ -14,3 +14,4 @@ Binarisierungsschritte
Kernelgröße
Gemorphtes
pytesseract
Funktions-Dekorator
This diff is collapsed.
Click to expand it.
Praxisbericht.pdf
+
0
−
0
View file @
94caf581
No preview for this file type
This diff is collapsed.
Click to expand it.
Praxisbericht.tex
+
24
−
0
View file @
94caf581
...
...
@@ -282,6 +282,30 @@
\section
{
Automatisiertes Testen
}
\label
{
sec: testing
}
Im Unterordner
\lstinline
{
./tests
}
befindet sich Testcode für das Python-Modul
\lstinline
{
pytest
}
. Dieser macht es sehr einfach, eine
Reihe an Testfällen zu definieren.
Dazu ist in der Datei
\lstinline
{
tests/test
_
imagerecon.py
}
die Funktion
\lstinline
{
test
_
knownimages()
}
implementiert. Für diese ist zuerst
eine Liste gültiger Codes global definiert. Dann werden über den Funktions-Dekorator
\lstinline
{
@pytest.mark.parametrize
}
einzelne
Testfälle dekoriert. Dieser definiert eine Liste mit Bilddateien und dem darauf befindlichen Codes und testet dann, ob die
\lstinline
{
main()
}
mit diesen Parametern das erwartete Ergebnis liefert. Die Funktion kann also leicht an aktuelle Bilder angepasst
werden. Hier der entsprechende code:
\begin{lstlisting}
[gobble=16]
valid
_
codes = ["SIE20220101", "FAT3264128"]
@pytest.mark.parametrize(
("path", "contained
_
codes"),
[
("tests/img/image1.png", ["FAT3264128"]),
("tests/img/image2.png", ["SIE20220101"]),
],
)
def test
_
knownimages(path, contained
_
codes):
assert contained
_
codes == main(path, valid
_
codes)
\end{lstlisting}
Um die Tests durchzuführen, kann direkt der Befehl
\lstinline
{
pytest
}
oder das Makefilerezept
\emph
{
test
}
verwendet werden.
\section
{
Debugging Optionen
}
\label
{
sec: debugging
}
\section
{
Packaging
}
\label
{
sub: packaging
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment