[couchdb-glib] Use gtester and gtester-report for running the test and generating the report
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [couchdb-glib] Use gtester and gtester-report for running the test and generating the report
- Date: Tue, 13 Apr 2010 07:52:42 +0000 (UTC)
commit 856df1d5dc4a1cb566f03b95564f071f1183a3ed
Author: Adi Roiban <adiroiban ubuntu com>
Date: Tue Apr 13 09:52:39 2010 +0200
Use gtester and gtester-report for running the test and generating the report
Makefile.am | 8 ++++++++
README | 24 ++++++++++++++++++++++++
tests/Makefile.am | 39 +++++++++++++++++++++++----------------
tests/config/couchdb-auth.ini | 29 +++++++++++++++++++++++++++++
tests/test-couchdb-glib.c | 2 +-
5 files changed, 85 insertions(+), 17 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 7fb5ed0..bed3086 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,4 +32,12 @@ dist-hook:
cp -f ChangeLog.in $(distdir)/ChangeLog && \
rm -f ChangeLog.in
+test: all
+ @$(am__cd) tests && \
+ $(MAKE) $(AM_MAKEFLAGS) test
+
+list-tests:
+ @$(am__cd) tests && \
+ $(MAKE) $(AM_MAKEFLAGS) list
+
CLEANFILES = $(pcfiles)
diff --git a/README b/README
index 56a16f3..a44eefa 100644
--- a/README
+++ b/README
@@ -16,6 +16,30 @@ To actually build it, do the following:
make
make install
+
+Testing
+=======
+To build couchdb-glib and desktop-couch-glib and the run all the tests do:
+
+ make test
+
+The test results are writen in tests/report.html.
+
+The testing database will be deleted after all tests are executed. To keep
+the testing database do the following and access it at
+http://test:test 127 0 0 1:5985/_utils/:
+
+ make test KEEP_COUCHDB=yes
+
+To list all available tests:
+
+ make list-tests
+
+To run only a subset from all tests:
+
+ make test TESTPATH="/couchdb-glib/Session"
+
+
API
===
The main entry point in the API is the CouchDB object, which is needed for all
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dd79d03..48c9dcd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,12 +8,6 @@ INCLUDES = \
-I$(top_srcdir)/couchdb-glib \
-I$(top_srcdir)/desktopcouch-glib
-noinst_PROGRAMS = \
- test-couchdb-glib \
- test-desktopcouch-glib \
- test-list-databases \
- test-oauth
-
test_list_databases_SOURCES = test-list-databases.c
test_list_databases_LDADD = \
$(COUCHDB_GLIB_LIBS) \
@@ -46,33 +40,46 @@ test_oauth_LDADD = \
EXTRA_DIST = createCouchContacts.py test-oauth.py
-check_PROGRAMS = test-couchdb-glib
+check_PROGRAMS = \
+ test-couchdb-glib \
+ test-desktopcouch-glib \
+ $(NULL)
+noinst_PROGRAMS = \
+ $(check_PROGRAMS) \
+ test-list-databases \
+ test-oauth \
+ $(NULL)
COUCHDB_VAR = $(top_srcdir)/tests/var
COUCHDB_PID = $(top_srcdir)/tests/config/couchdb.pid
COUCHDB_STDOUT = $(top_srcdir)/tests/var/couchdb.stdout
COUCHDB_STDERR = $(top_srcdir)/tests/var/couchdb.stderr
-COUCHDB_CONFIG_NOAUTH = $(top_srcdir)/tests/config/couchdb-noauth.ini
COUCHDB_CONFIG_AUTH = $(top_srcdir)/tests/config/couchdb-auth.ini
-
+REPORT_XML = $(top_srcdir)/tests/report.xml
+REPORT_HTML = $(top_srcdir)/tests/report.html
stop-couchdb:
@/usr/bin/couchdb -p $(COUCHDB_PID) -d
@/bin/rm -f $(COUCHDB_PID)
+list:
+ @/usr/bin/gtester -q -l -p="$(TESTPATH)" $(check_PROGRAMS)
+
test: $(check_PROGRAMS)
@echo "Setting up the couchdb server..."
+ @/usr/bin/couchdb -p $(COUCHDB_PID) -d > /dev/null
@/bin/rm -rf $(COUCHDB_VAR)
@/bin/mkdir -p $(COUCHDB_VAR)
- @/usr/bin/couchdb -p $(COUCHDB_PID) -d > /dev/null
@/usr/bin/couchdb -n -a /etc/couchdb/default.ini \
-o $(COUCHDB_STDOUT) -e $(COUCHDB_STDERR) \
-a $(COUCHDB_CONFIG_AUTH) -p $(COUCHDB_PID) -b > /dev/null
@/bin/sleep 1
- @$(top_srcdir)/tests/test-couchdb-glib "http://test:test 127 0 0 1:5984"
- @echo "Tearing down up the couchdb server..."
- @/usr/bin/couchdb -p $(COUCHDB_PID) -d > /dev/null
- @/bin/rm -f $(COUCHDB_PID)
- @/bin/rm -rf $(COUCHDB_VAR)
- @$(top_srcdir)/tests/test-desktopcouch-glib
+ -@/usr/bin/gtester -q -k -o $(REPORT_XML) -p="$(TESTPATH)" \
+ $(check_PROGRAMS) > /dev/null
+ -@/usr/bin/gtester-report $(REPORT_XML) > $(REPORT_HTML)
+ @keep_couchdb="$(KEEP_COUCHDB)x"; \
+ if test $$keep_couchdb == "x"; then \
+ echo "Tearing down the couchdb server..."; \
+ /usr/bin/couchdb -p $(COUCHDB_PID) -d > /dev/null; \
+ fi
diff --git a/tests/config/couchdb-auth.ini b/tests/config/couchdb-auth.ini
new file mode 100644
index 0000000..628f807
--- /dev/null
+++ b/tests/config/couchdb-auth.ini
@@ -0,0 +1,29 @@
+[couch_httpd_auth]
+require_valid_user = true
+
+[oauth_consumer_secrets]
+tLsCckqFPV = ntRaiJiuBX
+
+[oauth_token_users]
+tqSUhjJRMs = tpxQsaDSWd
+
+[oauth_token_secrets]
+tqSUhjJRMs = sHdBksSvmL
+
+[httpd]
+bind_address = 127.0.0.1
+port = 5985
+
+[couchdb]
+view_index_dir = var/couchdb_auth
+database_dir = var/couchdb_auth
+
+[log]
+file = var/couchdb-auth.log
+level = info
+
+; username = test
+; password = test
+[admins]
+test = -hashed-d175a4432182ff1abd6841c58fa25d3b51a59ec1,e57c36d165189a813392886b34e6f7d2
+
diff --git a/tests/test-couchdb-glib.c b/tests/test-couchdb-glib.c
index 465839f..10208ae 100644
--- a/tests/test-couchdb-glib.c
+++ b/tests/test-couchdb-glib.c
@@ -196,7 +196,7 @@ main (int argc, char *argv[])
g_test_init (&argc, &argv, NULL);
/* Initialize data needed for all tests */
- couchdb = argc > 1 ? couchdb_session_new (argv[1]) : couchdb_session_new (NULL);
+ couchdb = argc > 1 ? couchdb_session_new (argv[1]) : couchdb_session_new ("http://test:test 127 0 0 1:5985");
g_printf ("Connecting to Couchdb at %s\n", couchdb_session_get_uri (couchdb));
if (!couchdb) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]