-
Notifications
You must be signed in to change notification settings - Fork 6
Changes after review by Olaf #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,14 @@ MATE automatically opens the Python file of your test case and it appears in MeV | |
|
|
||
| ### Write Test Functions in Python | ||
|
|
||
| {{<alert class="info" caption="Info">}} | ||
| In this example, we are using the **ASSERT*** functionalities, becase they throw an exception in case the expected value does not match the actual value. Your test execution stops in this case. | ||
|
|
||
| You can also use **EXPECT*** functions. They return *true* or *false* and you can decide yourself ho your test continues. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better use 'True or False' to match the capitalization in Python. typo: ho -> how |
||
|
|
||
| For details, see {{< docuLinks "/Resources/Documentation/Publish/SDK/TestCenterReference/namespaceTestSupport_1_1Macros.html" "TestCenter Reference" >}} | ||
| {{</alert>}} | ||
|
|
||
| #### Preparations | ||
| Before writing a test case, we need some helper functions in Python, which we will use in our test cases. The first thing we need is a function to load images. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,20 @@ menu: | |
| ## Introduction | ||
| In this example you will learn how to write an automated test for a simple network using the `DicomImport`, `MinMaxScan`, and `View3D` modules. Afterward, you will be able to write test cases for any other module and network yourself. | ||
|
|
||
| MeVisLab provides two options to compare a test result with an expected result: | ||
| #### ASSERT | ||
| Multiple **ASSERT_*** functions to compare expected and actual result are available, for example **ASSERT_EQ()** (check if two values are equal) or **ASSERT_GT()** (check if value is greater than another value). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comma after 'for example': ... available, for example, ASSERT_EQ()... |
||
|
|
||
| In case an assertion fails, an exception is thrown and the test execution stops. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In case... -> In the case... Siehe oben |
||
| #### EXPECT | ||
| The same comparisons can be done by using **EXPECT_***. The functions return *true* or *false* and depending on the result you can decide how to proceed. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Auch hier lieber True und False schreiben (wie in Python). |
||
|
|
||
| Make sure to use the right comparison methods depending on your needs. | ||
|
|
||
| {{<alert class="info" caption="Info">}} | ||
| Additional information can be found in {{< docuLinks "/Resources/Documentation/Publish/SDK/TestCenterReference/namespaceTestSupport_1_1Macros.html" "TestCenter Reference" >}} | ||
| {{</alert>}} | ||
|
|
||
| ## Steps to Do | ||
|
|
||
| ### Creating the Network to be Used for Testing | ||
|
|
@@ -87,6 +101,8 @@ When *ready* is true, the test touches the *selectNextItem* trigger, so that the | |
|
|
||
| The value of our `DicomImport`s *progress* field is saved as the *currentValue* variable and compared to the *expectedValue* variable by calling *ASSERT_FLOAT_EQ(expectedValue,currentValue)* to determine if the DICOM import has finished (*currentValue* and *expectedValue* are equal) or not. | ||
|
|
||
| You can play around with the differences between **ASSERT_FLOAT_EQ()** and **EXPECT_FLOAT_EQ()** and le your test fail to see the differences. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: le -> let |
||
|
|
||
| ### Run Your Test Case | ||
| Open the TestCase Manager und run your test by selecting your test case and clicking on the *Play* button in the bottom right corner. | ||
|
|
||
|
|
@@ -126,5 +142,7 @@ Create a global macro module and implement the following test objectives for bot | |
| * MeVisLab provides a TestCenter for writing automated tests in Python. | ||
| * Tests can be executed on networks and macro modules. | ||
| * The test results are shown in a ReportViewer. | ||
| * **ASSERT*** functions throw an exception if the expected result differs from the actual result. The test run is aborted in such a case. | ||
| * **EXPECT*** functions return *true* or *false*. You can decide yoursel how to continue your test. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lieber True und False wie in Python schreiben. typo: yoursel -> yourself |
||
|
|
||
| {{< networkfile "examples/testing/example1/TestCases.zip" >}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,7 +85,11 @@ def testPatient(path, windowCenter): | |
| 4. The final test functions *ASSERT_EQ* evaluate if the given values are equal. | ||
|
|
||
| {{<alert class="info" caption="Info">}} | ||
| You can use many other *ASSERT** possibilities, just try using the MATE autocompletion and play around with them. | ||
| You can use many other **ASSERT*** possibilities, just try using the MATE autocompletion and play around with them. **ASSERT*** functions throw an exception in case expected and actul values do not fit. Your test execution stops in this case. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in case -> in the case |
||
|
|
||
| You can also use **EXPECT*** functions. They return *true* or *false* and you can decide yourself ho your test continues. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lieber True und False wie in Python schreiben. typo: ho -> how |
||
|
|
||
| For details, see {{< docuLinks "/Resources/Documentation/Publish/SDK/TestCenterReference/namespaceTestSupport_1_1Macros.html" "TestCenter Reference" >}} | ||
| {{</alert>}} | ||
|
|
||
| ### Run Your Iterative Test | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: becase -> because
in case -> in the case (bei 'in case' schwingt Dringlichkeit mit z.B. 'in case of fire...'; 'in the case' bedeutet einfach so viel wie 'if')