Rigorous and Reliable (RAR)

Full Version: BIBO tests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
BIBO tests

BIBO provides the following tests

server_addr: server address
bibo_server_addr="localhost"
bibo_server_port=62818

test_insert.sh:
Code:
casefile=zengxingliang.json
flog_also_stderr=True
ret = send insert request $casefile to $bibo_server_addr $bibo_server_port
if ($ret == 200) {
    flog "insert success"
    return 0
}
else {
    flog "insert failed"
    return 99
}

test_inquire_shen.sh: 用于测试处理20288个字符的查询请求时,是否会出现没有返回值的情况
test_inquire.sh:
Code:
casefile=chendengchang-with-blank-line.json
ret = send inquire request $casefile to $bibo_server_addr $bibo_server_port
flog_also_stderr=True
if ($ret == 200) {
    flog "inquire success"
    return 0
}
else {
    flog "inquire failed"
    return 99
}

test_select.sh:
Code:
casefile=sel_zengxingliang.json
flog_also_stderr=True
ret = send select request $casefile to $bibo_server_addr $bibo_server_port
if ($ret == 200) {
    flog "select success"
    return 0
}
else {
    flog "select failed"
    return 99
}

test_delete_zeng
test_indel_zeng

test_crds.sh: insert, inquire, select, delete and select.

test_isds.sh: test selecting a non-existent and an existent case
Code:
./test_insert.sh
./test_select.sh
./test_delete.sh
./test_select.sh

test_isdsd.sh: test deleting a non-existent case
Code:
./test_isds.sh
./test_delete.sh

test_pressure.sh:
Code:
bibo_test_iter_cnt=1
for (i in 1 to $bibo_test_iter_cnt) {
    ./test_insert.sh
    ./test_delete.sh
    ./test_isdsd.sh
}

test_insert_testcase.sh: insert test_case.json which has caseid:"aaaaa..." and casetitle: "计算机案例"
test_delete_testcase.sh: request to delete case with caseid "aaaaa..."

Historical info:
test_delete.sh:
Code:
casefile=del_zengxingliang.json
flog_also_stderr=True
ret = send delete request $casefile to $bibo_server_addr $bibo_server_port
if ($ret == 200) {
    flog "delete success"
    return 0
}
else {
    flog "delete failed"
    return 99
}

---
20210813/zhihao: add test case
20210522/lingu: indel
20201009/zhihao: add $bibo_server_addr and $bibo_server_port
20200926/lingu ran 'make test' but it failed.
Code:
12:38:28 lingu@g1b-2:/home/lingu/forest/prada/prada> make -C procuratorate test
make: Entering directory '/home/lingu/forest/prada/prada/procuratorate'
make: ./maketest.sh: Command not found
make: *** [Makefile:2: test] Error 127
make: Leaving directory '/home/lingu/forest/prada/prada/procuratorate'
12:38:33 lingu@g1b-2:/home/lingu/forest/prada/prada>

I removed maketest and made crds an individual test.

zhihao - Pls add our header to the make file. The header includes copyright notes, description of the file, and other info such as authors. You may refer to other files, such as procone.py, for reference.

zhihao

(09-26-2020 01:53 PM)lingu Wrote: [ -> ]20200926/lingu ran 'make test' but it failed.
Code:
12:38:28 lingu@g1b-2:/home/lingu/forest/prada/prada> make -C procuratorate test
make: Entering directory '/home/lingu/forest/prada/prada/procuratorate'
make: ./maketest.sh: Command not found
make: *** [Makefile:2: test] Error 127
make: Leaving directory '/home/lingu/forest/prada/prada/procuratorate'
12:38:33 lingu@g1b-2:/home/lingu/forest/prada/prada>

I removed maketest and made crds an individual test.

zhihao - Pls add our header to the make file. The header includes copyright notes, description of the file, and other info such as authors. You may refer to other files, such as procone.py, for reference.

Added header to test*.sh
Code:
[zhihao@g1b-2 procuratorate]$ git status
# On branch rc
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   test_delete.sh
#       modified:   test_insert.sh
#       modified:   test_read.sh
#       modified:   test_select.sh
#
[zhihao@g1b-2 procuratorate]$ git commit -m "add header to test*.sh"

zhihao

design test_select.sh:
Code:
insert_ret = run test_insert.sh

if ($insert_ret != 0)
    return $insert_ret

ret = send select request sel_zengxingliang.json to trajan.d-thinker.org 20050
if ($ret == 200) {
    print select success
}
else {
    print select failed
    return -1
}

del_ret = run test_delete.sh

if ($delete_ret != 0)
    return $delete_ret

ret = send select request sel_zengxingliang.json to trajan.d-thinker.org 20050
if ($ret == 404) {
    print select success
    return 0
}
else {
    print select failed
    return -1
}

RR lingu

zhihao

design test_delete.sh:
Code:
insert_ret = run test_insert.sh

if ($insert_ret != 0)
    print "insert failed, please try again"
    return $insert_ret

ret = send delete request del_zengxingliang.json to trajan.d-thinker.org 20050
if ($ret == 200) {
    print delete success
}
else {
    print delete failed
    return -1
}

ret = send delete request del_zengxingliang.json to trajan.d-thinker.org 20050
if ($ret == 404) {
    print delete success
    return 0
}
else {
    print delete failed
    return -1
}

RR lingu

zhihao

design test_insert.sh:
Code:
ret = send insert request zengxingliang.json to trajan.d-thinker.org 20050
if ($ret == 200) {
    print insert success
    return 0
}
else {
    print insert failed
    return -1
}

RR lingu

zhihao

design test_inquire.sh:
Code:
ret = send inquire request chendengchang-with-blank-line.json to trajan.d-thinker.org 20050

if ($ret == 200) {
  print "inquire success"
  return 0
}
else {
  print "inquire failed"
  return -1
}

RR lingu

zhihao

add test_pressure.sh design info:

Code:
for (i in 1 to 10) {
  run test_delete.sh
}

RR lingu
(09-26-2020 09:38 PM)zhihao Wrote: [ -> ]design test_select.sh:

insert_ret = run test_insert.sh

can you just run an insert test here?

Quote:if ($insert_ret != 0)
return $insert_ret

ret = send select request sel_zengxingliang.json to trajan.d-thinker.org 20050

dont hard-code trajan. Use a var.

Can you make a simple select test?

Quote:if ($ret == 200) {
print select success
}
else {
print select failed
return -1
}

del_ret = run test_delete.sh

if ($delete_ret != 0)
return $delete_ret

Can you just invoke the delete test?

Quote:ret = send select request sel_zengxingliang.json to trajan.d-thinker.org 20050
if ($ret == 404) {
print select success
return 0
}
else {
print select failed
return -1
}
[/code]

RR lingu

You can summarize the block above as 'expect 404, otherwise return -1'.

-1 is not a good exit status. Use a specific value, such as 99, to indicate the error.

This seems to be a combined test. You can name it test-isds -- insert, select, delete, select.
(09-26-2020 09:57 PM)zhihao Wrote: [ -> ]design test_delete.sh:

insert_ret = run test_insert.sh

if ($insert_ret != 0)
print "insert failed, please try again"
return $insert_ret

I think you can remove the above.

Quote:ret = send delete request del_zengxingliang.json to trajan.d-thinker.org 20050
if ($ret == 200) {
print delete success
}
else {
print delete failed
return -1
}

Pls return different exit code for 200 and 404 scenarios.

Quote:ret = send delete request del_zengxingliang.json to trajan.d-thinker.org 20050
if ($ret == 404) {
print delete success
return 0
}
else {
print delete failed
return -1
}
[/code]

RR lingu

You can add the case of deleting a non-existent case in another test, such as isds -- just make it isdsd.
Pages: 1 2 3
Reference URL's