我正在嘗試使用smartrics-RestFixture-3.0-bin.zip來處理POST請求,但由於某種原因它失敗。看起來像服務問題本身,但是當我正在學習Fitnees時,並不確定Test是否有問題。如何使用RestFixture編寫POST/PUT請求
任何人都可以請介紹一些細節,或者例如使用使用演示的REST API RestFixture /維基格式的POST REST請求 - 基於http://www.thomas-bayer.com/sqlrest/CUSTOMER/
我的wiki TC看起來像下面 - (我想補充的客戶數據與ID = 20)
'''Trying to add customer 20 entry'''
!| smartrics.rest.fitnesse.fixture.FitRestFixture | http://www.thomas-bayer.com/sqlrest/CUSTOMER/ |
| setBody | <CUSTOMER xmlns:xlink="http://www.w3.org/1999/xlink"><ID>20</ID><FIRSTNAME>Anne1</FIRSTNAME><LASTNAME>Miller1</LASTNAME><STREET>201 Upland Pl.</STREET><CITY>Lyon1</CITY></CUSTOMER> |
| POST | /20| 200 | | |
我得到以下錯誤:
<html><head><title>Apache Tomcat/7.0.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error() that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.26</h3></body></html>
請建議。謝謝!
更新時間:2015
我嘗試使用POST方法,這是不正確的添加新客戶進入4月6日,我應該使用PUT方法。今天,當我嘗試使用PUT方法來添加新客戶准入,我得到了同樣的錯誤:(..
貌似只有web服務的問題。
謝謝Fried回覆。我也認爲服務有一些問題..不知道它是公共服務,真的不知道它的地位。 您是否認爲表格或測試方式是正確的? 想知道測試/數據或其創建方式是否有問題?請給出意見。謝謝! – OverrockSTAR 2015-04-04 07:55:11
測試表及其結構看起來不錯,因爲請求正確到達服務器。通過將setBody的內容放在! - - 中重試! :| setBody | ! - <客戶.... - ! |以確保有效載荷中的字符不會錯誤地逃脫。您可能還想打開日誌並觀察打印實際HTTP請求/ respose的輸出控制檯。 – smartrics 2015-04-04 08:24:15
表看起來相當不錯。我嘗試發送相同的內容(使用我自己的夾具,請參閱https://github.com/fhoeben/hsac-fitnesse-fixtures/wiki/4.-XmlHttpTest-Examples)並得到相同的回覆 – 2015-04-04 14:25:31