tree: 76f93e6e9fb37d2288b0d540eae740d05f7b36b7 [path history] [tgz]
  1. utils/
  2. README.md
  3. test
  4. test_auth.sh
  5. test_create_collection.sh
  6. test_delete_collection.sh
  7. test_help.sh
  8. test_start_solr.sh
solr/bin-test/README.md

bin/solr Tests

This directory contains tests for the bin/solr command-line scripts. For instructions on running these tests, run bin-test/test -h.

Test Harness/Infrastructure

Where possible, these tests model themselves after the pattern well-established by JUnit.

  • JUnit's @Test is emulated using the function name prefix: solr_test_ Any bash functions starting with that prefix are identified as tests.
  • JUnit's @Before and @After are imitated using the function names solr_unit_test_before, and solr_unit_test_after. If a suite contains these functions, they will be run before and after each test.
  • JUnit's @BeforeClass and @AfterClass are imitated using the function names: solr_suite_before, and solr_suite_after. If a suite contains these functions, they will be run at the very beginning and end of suite execution.
  • Test success/failure is judged by the test's return value. 0 indicates success; non-zero indicates failure. Unlike in JUnit/Java which has exceptions, bash assertions have no way to suspend test execution on failure. Because of this, assertions are often followed by || return 1, which ensures the test exists immediately if the assertion fails. Existing tests provided examples of this.

Test Helpers

A variety of assertions and general utilities are available for use in bin-test/utils/.

Limitations

  1. Currently this test suite is only available for *nix environments
  2. Tests written in bash are both slow, and harder to maintain than traditional JUnit tests. If a test can be written as a JUnit test, it should be. This suite should only be used to test things that cannot be tested by JUnit.