Skip to content
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

Migrate 'Unit Test' to jenkins.io developer docs #3385

Closed
wants to merge 5 commits into from

Conversation

bigdevlarry
Copy link

Description

  • Page to migrate: Unit Test
  • Destination on jenkins.io : Testing
  • Fix #3320

    @bigdevlarry bigdevlarry requested a review from a team as a code owner May 28, 2020 13:28
    @probot-autolabeler probot-autolabeler bot added the documentation Jenkins documentation, including user and developer docs, solution pages, etc. label May 28, 2020
    Copy link
    Contributor

    @MarkEWaite MarkEWaite left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    This pull request is mixing multiple changes that are unrelated to 'Unit test'. It needs to be reworked to remove the 'agent to master control' changes.

    Copy link
    Contributor

    @MarkEWaite MarkEWaite left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Several sections in this new page already exist in the index.adoc file. I've marked them for removal here.

    Other items need correction (like HUDSON_ -> JENKINS_ ).

    My apologies for the long delay and for the inadequate triage of this page before including it in the candidate pages. The migration of this page is difficult due to the age of the page and the evolving nature of Jenkins development.

    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    content/doc/developer/testing/unit-test.adoc Outdated Show resolved Hide resolved
    @bigdevlarry
    Copy link
    Author

    @MarkEWaite @oleg-nenashev @v1v @markyjackson-taulia I have been able to go through and reviewed the changes.

    Copy link
    Contributor

    @uhafner uhafner left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    I wonder if we also can split that file so that the UI testing part can be separated into another page (where we can make clear that this approach is not recommended or at least will create problems while we are modernizing Jenkins UI).

    @@ -0,0 +1,435 @@
    ---
    layout: section
    title: Unit test
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    The name unit test is misleading, this document is actually describing integration testing within Jenkins. Unit tests are tests of source code units in isolation (without a running Jenkins instance). We should not change semantics of well known definitions (this was wrong in the wiki already but when we migrate it to the new home we should consider using the correct names).

    title: Unit test
    ---

    [[UnitTest-Overview]]
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Suggested change
    [[UnitTest-Overview]]
    [[IntegrationTest-Overview]]

    Comment on lines +12 to +15
    . Starts an embedded servlet container so that the test code can
    exercise user interaction through HTTP and assert based on the outcome.
    . http://htmlunit.sourceforge.net/[HtmlUnit] with a bit of enhancements
    allows you to productively test HTTP/UI interaction.
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Currently a lot of plugins use this approach but I cannot recommend it anymore. While we are using more and more rich and modern UI libraries that are not compatible with HTMLUnit we are creating obstacles by those tests that slow down progress (see jenkinsci/junit-plugin#272). UI testing should be solely done using ATH plugin tests.

    Comment on lines +29 to +36
    If you are using the Plugin Parent POM 2.3 or later the version of the
    Jenkins Test Harness (which starting in version 2.0 is an artifact
    independent from Jenkins Core) to be used for the tests can be
    configured using the `+jenkins-test-harness.version+`. For 1.x versions
    of the Plugin POM the version used is the same of the parent POM which
    is equal to the Jenkins baseline version. The recommended version of
    Jenkins Test Harness is 2.1 or above unless your plugin depends on
    Jenkins < 1.580.
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    I think this section is obsolete in 2022.

    == Example

    The following code shows a very simple test case. Your test will use
    http://javadoc.jenkins-ci.org/byShortName/JenkinsRule[JenkinsRule] to
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    This URL does not exist

    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Maybe also check for other HTTP URLs in this document.

    project.getBuildersList().add(new Shell("echo hello"));
    FreeStyleBuild build = project.scheduleBuild2(0).get();
    System.out.println(build.getDisplayName() + " completed");
    // TODO: change this to use HtmlUnit
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Delete line

    Suggested change
    // TODO: change this to use HtmlUnit


    Your IDE will most likely have the ability to select a single JUnit test
    and execute it in the debugger. Otherwise you can run
    `+mvn -Dmaven.surefire.debug -Dtest=hudson.SomeTest test+` to accomplish
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Suggested change
    `+mvn -Dmaven.surefire.debug -Dtest=hudson.SomeTest test+` to accomplish
    `+mvn -Dmaven.surefire.debug -Dtest=SomeTest test+` to accomplish

    ----

    [[UnitTest-HTMLscraping]]
    === HTML scraping
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    See above

    @MarkEWaite MarkEWaite added stalled Pull requests that are not progressing wiki-migration Jenkins Wiki Migration to jenkins.io and removed stalled Pull requests that are not progressing labels Sep 8, 2022
    @MarkEWaite MarkEWaite added the stalled Pull requests that are not progressing label Apr 20, 2023
    @kmartens27
    Copy link
    Contributor

    As this pull request has not had any updates from the submitter since June 2020, and has been marked stalled (as discussed in Jenkins Documentation SIG office hours)[https://docs.google.com/document/d/1ygRZnVtoIvuEKpwNeF_oVRVCV5NKcZD1_HMtWlUZguo/edit#heading=h.cao5dku7jwfn], it will be closed and linked to the original issue that will give others an opportunity to continue the work already started here.

    @kmartens27 kmartens27 closed this May 5, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    documentation Jenkins documentation, including user and developer docs, solution pages, etc. stalled Pull requests that are not progressing wiki-migration Jenkins Wiki Migration to jenkins.io
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Migrate 'Unit Test' to jenkins.io developer docs
    5 participants