- Concepts (Testing, Test-Driven Development)
- DbFit
- Demo
The system that is being tested
Performed to make sure that previously working functionality still works after changes elsewhere in the system
Is the the process of changing a system in such a way that
Doing refactoring without tests is unsafe
Inline configuration:
!|Connect|localhost:1521|username|password|dbname|
Using properties file:
!|ConnectUsingFile|DBConnection.properties|
service=localhost:1521 username=username password=password database=dbname
!|insert|testtbl| |n |name | |1 |NAME1 | |3 |NAME3 | |2 |NAME2 | !|query|select * from testtbl| |n |name | |1 |NAME1 | |3 |NAME3 | |2 |NAME2 |
!|Ordered Query|select * from testtbl order by n| |n |name? | |1 |NAME1 | |3 |NAME3 | |2 |NAME2 |
!|insert|testtbl| |n |name | |1 |NAME1 | |3 |NAME3 | |2 |NAME2 |
!2 No parameters !|Execute Procedure|do_stuff| !2 Functions - return values with "?" !|Execute Procedure|zlpad_notrunc | |p_str |p_padded_len|? | |'12' |5 |'00012' | !2 OUT parameters - "?" suffix !|Execute Procedure|split_name| |p_fullname |p_first_name?|p_last_name?| |Mikey Mouse|Mickey |Mouse | !2 IN OUT parameters - specify twice !|Execute Procedure|make_double| |x|x?| |3|6 |
!2 Expect ORA-20013 !|Execute procedure expect exception|set_age|20013| |p_age | |-5 |
set parameter
to set parameter directly>>paramname
- store a value<<paramname
- read the value!|set parameter|ONE|1| !|query|select sysdate mytime from dual| |mytime? | |>>current_time | !|query|select count(*) cnt from dual where sysdate >= :current_time| |cnt | |<<ONE |
!|Store Query|select 1 n from dual union select 2 n from dual|firsttable| !|query|<<firsttable| |n | |1 | |2 |
!|insert|testtbl| |n |name | |1 |NAME1 | |3 |NAME3 | |2 |NAME2 | |Store Query|select * from testtbl|fromtable| |Store Query|!- select 1 n, 'name1' name from dual|fromdual| |compare stored queries|fromtable|fromdual| |name |n? |
!3 In Flow mode !|dbfit.OracleTest| !|Connect|ourhost:1521|dbusername|dbpassword|mydb| # Alternatively - TNS descriptor can be used: #!|Connect|(DESCRIPTION=(ADDRESS=...))|
!3 In Standalone mode |import fixture| |dbfit.fixture| !|DatabaseEnvironment|oracle| |connect|localhost:1521|dbusername|dbpassword|mydb|
!3 Load some data with Oracle SQL*Loader |com.objectmentor.fixtures.CommandLineFixture | |command|${PROJECT_ROOT}/loaderdemo/load_employee.sh| !|Query|select * from employee | |id |name? |dept? |salary?| |100 |Thomas|Sales |5000 | |200 |Jason |Technology|5500 | |300 |Mayla |Technology|7000 | |400 |Nisha |Marketing |9500 | |500 |Randy |Technology|6000 | |501 |Ritu |Accounting|5400 |
Running tests from command line
java -jar fitnesse-standalone.jar \ -d "${TESTS_DIR}" \ -c "BgougDemoSuite?suite&format=text"
Run test or suite as RESTful service http://fitnesse.org/FitNesse.UserGuide.RestfulServices
nikolov dot javor at gmail