Dbfit - COMMAND_PATTERN Usage( Customizing Test Execution) and Encrypt/Decrypt password issues

68 views
Skip to first unread message

vvkv24

unread,
Jul 22, 2017, 11:49:03 PM7/22/17
to dbfit
Hi - Our team is using Dbfit for oracle db table comparison testing. Below is a sample fixture and config. Everything works fine but encrypted password provided is thrown as invalid user id/password if Command_Pattern is used as below.However encrypted password is working fine for other tests that does not depend on command_pattern.
Your help is much appreciated.

Working test that is not depended on COMMAND_PATTERN or TEST_RUNNER

!path lib\*.jar
!|dbfit.OracleTest|
!|ConnectUsingFile|DatabaseConnectionOracleCCD.config|

!|Inspect Query|!- 
select query from table |

But when couple of additional parameters are introduced encrypted password are considered as direct passwords and its not working , like below.

!define COMMAND_PATTERN {%m -r fitnesse.fitserver.FitServer,F:\dbfit\fitsharp\dbfit.Oracle.dll %p}
!define TEST_RUNNER {fitsharp\Runner.exe}
!path lib\*.jar
!|dbfit.OracleTest|
!|ConnectUsingFile|DatabaseConnectionOracleCCD.config|

!|Inspect Query|!- 
select query from table |


How help how to override and tell dbfit to still decrypt the password even with using COMMAND_PATTERN and TEST_RUNNER  as my team has tones of scripts developed already with that pattern usage but I want them to use encrypted password while running instead of originals but password decryption is happening only if we dont have  Customizing Test Execution


Regards,
ViVi
Viduthalai Virumbi Kanagaraj

vvkv24

unread,
Jul 22, 2017, 11:51:53 PM7/22/17
to dbfit
System/Environment:
OS : Windows 7 ,using Java dbfit and Oracle db testing.

Yavor Nikolov

unread,
Jul 23, 2017, 2:38:19 AM7/23/17
to dbfit
Hi ViVi,

The following:
!define TEST_RUNNER {fitsharp\Runner.exe}

means that you're using not the Java version of DbFit but the .NET variant (Fitsharp).

I guess you may either try to migrate to using DbFit Java & Fit. Or you if you need to stick to Fitsharp - you may seek assistance from its community.

Best Regards,
Yavor

On Sun, Jul 23, 2017 at 6:51 AM, vvkv24 <vvk...@gmail.com> wrote:
System/Environment:
OS : Windows 7 ,using Java dbfit and Oracle db testing.

--
You received this message because you are subscribed to the Google Groups "dbfit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+unsubscribe@googlegroups.com.
To post to this group, send email to db...@googlegroups.com.
Visit this group at https://groups.google.com/group/dbfit.
For more options, visit https://groups.google.com/d/optout.

vvkv24

unread,
Jul 24, 2017, 2:29:44 PM7/24/17
to dbfit
Hi Nikolov,

Thanks for your reply, it was very helpful in understanding core issue we had.
We also decided to use only Java dbfit as we dont have any dependency on .net and wanted to use against both linux/windows.
When we run the same dbfit scripts against java , we get below errors which was not an issue while using .net r. We tried couple of solution(adding |set option|bind symbols|false|) but it didnt work for us.

Thanks in advance for your help.

Please note: Below are sample queries & may not work as I mocked table and column names for security reasons as you may know.

Issue 1) When query returns no results or expected result is none (same query works fine in toad/sqldeveloper)Eg:  test to validate no duplicates or no error logs in a table
Sample Query:

select example.* from (
select sum(CNTR) over (partition by 1) as TOTAL_ISSUES_CNT, rn.*, ROWNUM as ROW_NUMBER from ( 
select count(distinct PRIMARY_KEY||FOREIGN_KEY) over (partition by 1) as CNTR, cntr_rcdset.* from (
select 
table1.column1 AS PRIMARY_KEY,
table1.column2 AS FOREIGN_KEY
from dbname.table1 table1
group by table1.column1 , table1.column2
having count(*) > 1
) cntr_rcdset
) rn where rn.CNTR > 0 order by 1, 2
) example where example.ROW_NUMBER <= 10;

Results log: java.lang.Exception: Unknown column record_id at dbfit.fixture.RowSetFixture.findColumn(RowSetFixture.java:63) at dbfit.fixture.RowSetFixture.bind(RowSetFixture.java:74) at fit.ColumnFixture.doRows(ColumnFixture.java:18) at dbfit.fixture.RowSetFixture.doRows(RowSetFixture.java:93) at fit.Fixture.doTable(Fixture.java:156) at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21) at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104) at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89) at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73) at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27) at fitlibrary.DoFixture.interpretTables(DoFixture.java:42) at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26) at fit.Fixture.doTables(Fixture.java:81) at fit.FitServer.process(FitServer.java:81) at fit.FitServer.run(FitServer.java:56) at fit.FitServer.main(FitServer.java:41)

Issue 2) This query has symbols etc which works fine when its run in toad/sqldeveloper but same query returns oracle error when running using dbfit/java but works fine with .net
Sample Query : 

select example.* from (
select sum(CNTR) over (partition by 1) as TOTAL_ISSUES_CNT, rn.*, ROWNUM as ROW_NUMBER from ( 
select Column1 as CNTR, cntr_rcdset.* from (
select t1.RECORD_ID
,regexp_substr(t1.column2, '\w+', 1, t2.column_value) as MISSING_FK_ID 
,regexp_count( t1.column2, ':' )+1 as NUM_OF_MISSING_RCDS
from dbname.Table1 t1, 
table( cast(multiset(select level from dual connect by level <= length(t1.column2) - length(replace(t1.column2, ':', '')) + 1 ) as sys.odcinumberlist )) t2
where (t1.RECORD_ID is not null )
and to_char(t1.RECORD_ID ||':'||regexp_substr(t1.column2, '\w+', 1, t2.column_value)) not in ( 
select to_char(brdg.column1||':'||brdg.column2) from dbname.Table1 brdg )
) cntr_rcdset
) rn where rn.CNTR > 0 order by 1, 2
) example where example.ROW_NUMBER <= 10;

Results log:
java.sql.SQLSyntaxErrorException: ORA-00920: invalid relational operator at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207) at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884) at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628) at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493) at dbfit.fixture.Inspect.inspectQuery(Inspect.java:82) at dbfit.fixture.Inspect.doTable(Inspect.java:47) at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21) at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104) at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89) at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73) at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27) at fitlibrary.DoFixture.interpretTables(DoFixture.java:42) at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26) at fit.Fixture.doTables(Fixture.java:81) at fit.FitServer.process(FitServer.java:81) at fit.FitServer.run(FitServer.java:56) at fit.FitServer.main(FitServer.java:41)

Yavor Nikolov

unread,
Jul 24, 2017, 2:57:07 PM7/24/17
to dbfit
Hi ViVi,

I suspect you may be hitting an issue related to <, > characters and using multi-line queries (surrounded by !- -!):

You may try fitting your query on single line without !- -! (I know, it's a bit ugly). Or to run your test in standalone mode.

Best Regards,
Yavor

vvkv24

unread,
Jul 24, 2017, 5:02:04 PM7/24/17
to dbfit

Hi Yovor Nik, Thank you! you were right, It didn't like those symbols, so I made 3 changes in query for it to work.

1. Add inspect query instead of just Query , i.e !|Inspect Query|!-select a.* from table a -!|
2.  Replaced <> to !=(both oracle & java accepts same relational operator), so it took it
3. (This is weird) for some reason its not accepting > or >= but it accepts < or <= , for greater than or greater equals it throws relational operator identifier & right parenthesis missing errors respectively, however I cannot totally blame on dbfit for this as it accepts > or >= in some places but not other could be the way query and subquery are designed and those columns are used in where clause

For now, I think we got it working, but I will post/reach to you for any help in future.

Thanks a lot for your help so far.
Reply all
Reply to author
Forward
0 new messages