我们已经开始使用 citrus 集成框架进行 API 测试。我正在尝试在 oracle 数据库上运行 SQL INSERT 查询。
如果我们运行带有 select 关键字的 SQL,它就可以正常工作,但是如果我们想插入数据,它会抛出空指针 exception.stack trace 下面。可以请一些建议。
com.consol.citrus.exceptions.TestCaseFailedException:测试用例失败
at com.consol.citrus.TestCase.executeAction(TestCase.java:221)
at com.consol.citrus.dsl.runner.DefaultTestRunner.run(DefaultTestRunner.java:189)
at com.consol.citrus.dsl.runner.DefaultTestRunner.query(DefaultTestRunner.java:249)
at com.consol.citrus.dsl.testng.TestNGCitrusTestRunner.query(TestNGCitrusTestRunner.java:170)
at com.consol.citrus.samples.DomainAPITest.sqlPMTest(DomainAPITest.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.invokeTestMethod(TestNGCitrusTest.java:130)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:100)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:58)
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:208)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:635)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
引起:com.consol.citrus.exceptions.CitrusRuntimeException:语句中缺少关键字 SELECT:INSERT INTO CN_RATE_EXHIBIT (ID,RATE_EXHIBIT_CODE,DS,DSL,STATUS,RECIPROCAL_IND,START_DATE,END_DATE,TERM_REASON) 值 (seqCN_RATE_EXHIBIT.nextval,'Citrus_Inte_RE_Code' ,'Citrus_Inte_RE_Code_DS','Citrus_Inte_RE_CodeDSL',null,'Y',to_date('01-JUN-16','DD-MON-RR'),to_date('01-JAN-4000','DD-MON-RR '),'O') 在 com.consol.citrus.actions.ExecuteSQLQueryAction.validateSqlStatement(ExecuteSQLQueryAction.java:266) 在 com.consol.citrus.actions.ExecuteSQLQueryAction.doExecute(ExecuteSQLQueryAction.java:84) 在 com.consol。 citrus.actions.AbstractDatabaseConnectingTestAction.execute(AbstractDatabaseConnectingTestAction.java:62) 在 com.consol.citrus.TestCase.executeAction(TestCase.爪哇:214)