tests/README.md updated

pull/85/head
moneroexamples 6 years ago
parent 3424802830
commit 79e207a821

@ -15,7 +15,7 @@ if (NOT MONERO_DIR)
set(MONERO_DIR ~/monero)
endif()
option(BUILD_TEST "Build tests for the project" ON)
option(BUILD_TEST "Build tests for the project" OFF)
message(STATUS MONERO_DIR ": ${MONERO_DIR}")
@ -158,18 +158,16 @@ endif()
target_link_libraries(${PROJECT_NAME} ${LIBRARIES})
#set(COVERAGE_EXCLUDES 'ext/*' '${MONERO_DIR}/*')
include_directories(
if (${BUILD_TEST})
include_directories(
${CMAKE_SOURCE_DIR}/ext/googletest/googletest/include
${CMAKE_SOURCE_DIR}/ext/googletest/googlemock/include)
#include_directories(${MONERO_DIR}/tests/core_tests)
endif()
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/sql ${CMAKE_CURRENT_BINARY_DIR}/sql)
enable_testing()
add_subdirectory(ext/googletest)
add_subdirectory(tests)
if (${BUILD_TEST})
enable_testing()
add_subdirectory(ext/googletest)
add_subdirectory(tests)
endif()

@ -23,7 +23,8 @@ SET time_zone = "+00:00";
-- Database: `openmonero`
--
USE openmonero;
CREATE DATABASE IF NOT EXISTS `openmonero` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `openmonero`;
-- --------------------------------------------------------

@ -23,7 +23,8 @@ SET time_zone = "+00:00";
-- Database: `openmonero_test`
--
USE openmonero_test;
CREATE DATABASE IF NOT EXISTS `openmonero_test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `openmonero_test`;
-- --------------------------------------------------------

@ -1,3 +1,60 @@
## Testing OpenMonero
## Testing openmonero
Description how to run tests etc.
[Googletest](https://github.com/google/googletest) and
[googlemock](https://github.com/google/googletest/tree/master/googlemock)
frameworks are used for unit testing of openmonero. There is no need
to install them, as they are provided with openmonero.
### MySQL setup
Testing openmonero's operations on MySQL database are performed using
actuall mysql database. For this purpose a testing database with
some pre-populated data is used: `openmonero_test`. Thus before
tests are run, make sure that `openmonero_test` database is initilized
using `openmonero/sql/openmonero_test.sql` file, and `database_test` contains
information on conneting to the test database in
`openmonero/config/config.json`.
### Compile and run openmonero tests
```bash
# go into build folder of openmonero
cd openmonero/build
# indicate that test should be build
cmake .. -DBUILD_TEST=ON
# compile openmonero with tests
make
# run all tests
make test
# the above command will produce summary of test results (shown below).
# for verbouse output, the following command can use
# make test ARGS=-V
# individual tests executables can also be run. they are located in
# openmonero/build/tests
```
Example test output is:
```bash
mwo@arch:build$ make test
Running tests...
Test project /home/mwo/openmonero/build
Start 1: mysql_tests
1/4 Test #1: mysql_tests ...................... Passed 60.64 sec
Start 2: microcore_tests
2/4 Test #2: microcore_tests .................. Passed 1.67 sec
Start 3: bcstatus_tests
3/4 Test #3: bcstatus_tests ................... Passed 25.39 sec
Start 4: txsearch_tests
4/4 Test #4: txsearch_tests ................... Passed 1.04 sec
100% tests passed, 0 tests failed out of 4
Total Test time (real) = 88.79 sec
```

Loading…
Cancel
Save