mirror of https://github.com/apache/lucene.git
2ca741d36a | ||
---|---|---|
.. | ||
utils | ||
README.md | ||
test | ||
test_create_collection.sh | ||
test_delete_collection.sh | ||
test_help.sh | ||
test_start_solr.sh |
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 namessolr_unit_test_before
, andsolr_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
, andsolr_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
- Currently this test suite is only available for *nix environments
- 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.