Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Testing

Unit tests

JUnit tests are the simple and fast tests that use mocks to check simple, single functionality. You should write JUnit to check every function that you use in your code. JUnit must be fast, it should be matters of seconds to run that test.

...

To run our test all we have to do is just run our test
 

If everything was configured correct, we should got message about completed tests.

Image Added

After completed tests Cucumber automatically generate report file, where you can check what was tested, or if something went wrong where was the problem. Report file is generated as file (...)/<moduleName>/target/cucumber/index.html.

Image Added

Example test

Feature file

Code Block
Feature: testData
  Scenario:
    Given Configured properties
    When I fetch project history data
    And I get Revisions from file JIoEndpoint.java
    Then Author should match "markt"
    And Comment should contain "Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53063"
    And New file content should contain "setMaxConnections(getMaxThreadsExecutor(true));"
    And New file content should not contain "setMaxConnections(getMaxThreads());"
    And Old file content should contain "setMaxConnections(getMaxThreads());"
    And Old file content should not contain "setMaxConnections(getMaxThreadsExecutor(true));"
    And revision number should be equal to "1336884"
    And File change type should be defined with "CHANGED_CONTENT"

...