鎺ュ彛娴嬭瘯绁炲櫒Apifox
Posted 杞欢娴嬭瘯鍚?/a> 鎺ュ
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鎺ュ彛娴嬭瘯绁炲櫒Apifox相关的知识,希望对你有一定的参考价值。
鐐瑰嚮馃憜杞欢娴嬭瘯鍚?/span>馃憜鍏虫敞鎴戯紝鍔?/span>鈽?/span>鏄熸爣鈽?/span>
鏈枃鍏?739瀛?nbsp; 闃呰绾﹂渶5鍒嗛挓
锛堝悗鍙板洖澶?/span>鈥滅牬瑙hˉ涓佲€?/span>鍗冲彲棰嗗彇鏈€鏂版縺娲荤爜锛?/span>
鍋剁劧闂村彂鐜拌繖娆炬祴璇曞伐鍏稟pifox锛屾殏鏃惰繕娌℃湁鎯冲ソ璇ユ妸瀹冨畾涔変负浠€涔堢敤閫斾笂鐨勫伐鍏枫€?/p>
浣嗘槸锛岀粰鎴戞劅瑙夛紝灏辨槸寰堝ソ鐢紝鑰屼笖鍚庨潰杩樻湁寰堝寮€鍙戠殑鍔熻兘鏄垜寰堟湡寰呯殑銆?/p>
鏍规嵁瀹樻柟缁欏嚭鐨勭畝鍗曟弿杩帮紝瀹冭兘鍋氱殑浜嬪氨鏄細
Apifox = Postman + Swagger + Mock + JMeter
涓€銆丄pifox 浠嬬粛
Apifox 鏄帴鍙g鐞嗐€佸紑鍙戙€佹祴璇曞叏娴佺▼闆嗘垚宸ュ叿锛屽畾浣?Postman + Swagger + Mock + JMeter銆傞€氳繃涓€濂楃郴缁熴€佷竴浠芥暟鎹紝瑙e喅澶氫釜绯荤粺涔嬮棿鐨勬暟鎹悓姝ラ棶棰樸€傚彧瑕佸畾涔夊ソ鎺ュ彛鏂囨。锛屾帴鍙h皟璇曘€佹暟鎹?Mock銆佹帴鍙f祴璇曞氨鍙互鐩存帴浣跨敤锛屾棤闇€鍐嶆瀹氫箟锛涙帴鍙f枃妗e拰鎺ュ彛寮€鍙戣皟璇曚娇鐢ㄥ悓涓€涓伐鍏凤紝鎺ュ彛璋冭瘯瀹屾垚鍚庡嵆鍙繚璇佸拰鎺ュ彛鏂囨。瀹氫箟瀹屽叏涓€鑷淬€傞珮鏁堛€佸強鏃躲€佸噯纭紒
浜屻€丄pifox 鑳藉仛浠€涔?/span>
-
鎺ュ彛璁捐锛?br>Apifox 鎺ュ彛鏂囨。閬靛惊 OpenApi 3.0 (鍘?Swagger)銆丣SON Schema 瑙勮寖鐨勫悓鏃讹紝鎻愪緵浜嗛潪甯稿ソ鐢ㄧ殑鍙鍖栨枃妗g鐞嗗姛鑳斤紝闆跺涔犳垚鏈紝闈炲父楂樻晥銆?/p>
-
鏁版嵁妯″瀷锛?br>鍙鐢ㄧ殑鏁版嵁缁撴瀯锛屽畾涔夋帴鍙h繑鍥炴暟鎹粨鏋勫強璇锋眰鍙傛暟鏁版嵁缁撴瀯锛堜粎 JSON 鍜?XML 妯″紡锛夋椂鍙洿鎺ュ紩鐢ㄣ€?/p>
-
鎺ュ彛璋冭瘯锛?br>Postman 鏈夌殑鍔熻兘锛屾瘮濡傜幆澧冨彉閲忋€侀鎵ц鑴氭湰銆佸悗鎵ц鑴氭湰銆丆ookie/Session 鍏ㄥ眬鍏变韩 绛夊姛鑳斤紝Apifox 閮芥湁锛屽苟涓斿拰 Postman 涓€鏍烽珮鏁堝ソ鐢ㄣ€傛帴鍙h繍琛屽畬涔嬪悗鐐瑰嚮淇濆瓨涓虹敤渚嬫寜閽紝鍗冲彲鐢熸垚鎺ュ彛鐢ㄤ緥锛屽悗缁彲鐩存帴杩愯鎺ュ彛鐢ㄤ緥锛屾棤闇€鍐嶈緭鍏ュ弬鏁帮紝闈炲父鏂逛究銆?/p>
-
鎺ュ彛鐢ㄤ緥锛?br>閫氬父涓€涓帴鍙d細鏈夊绉嶆儏鍐电敤渚嬶紝姣斿鍙傛暟姝g‘鐢ㄤ緥銆佸弬鏁伴敊璇敤渚嬨€佹暟鎹负绌虹敤渚嬨€佷笉鍚屾暟鎹姸鎬佺敤渚嬬瓑绛夈€傝繍琛屾帴鍙g敤渚嬫椂浼氳嚜鍔ㄦ牎楠屾暟鎹纭€э紝鐢ㄦ帴鍙g敤渚嬫潵璋冭瘯鎺ュ彛闈炲父楂樻晥銆?/p>
-
鏁版嵁 Mock锛?br>鍐呯疆 Mock.js 瑙勫垯寮曟搸锛岄潪甯告柟渚?mock 鍑哄悇绉嶆暟鎹紝骞朵笖鍙互鍦ㄥ畾涔夋暟鎹粨鏋勭殑鍚屾椂鍐欏ソ mock 瑙勫垯銆傛敮鎸佹坊鍔犫€滄湡鏈涒€濓紝鏍规嵁璇锋眰鍙傛暟杩斿洖涓嶅悓 mock 鏁版嵁銆傛渶閲嶈鐨勬槸 Apifox 闆堕厤缃?鍗冲彲 Mock 鍑洪潪甯镐汉鎬у寲鐨勬暟鎹紝鍏蜂綋鍦ㄦ湰鏂囧悗闈粙缁嶃€?/p>
-
鎺ュ彛鑷姩鍖栨祴璇曪細
鎻愪緵鎺ュ彛闆嗗悎娴嬭瘯锛屽彲浠ラ€氳繃閫夋嫨鎺ュ彛锛堟垨鎺ュ彛鐢ㄤ緥锛夊揩閫熷垱寤烘祴璇曢泦銆傜洰鍓嶆帴鍙h嚜鍔ㄥ寲娴嬭瘯鏇村鍔熻兘杩樺湪寮€鍙戜腑锛屾暚璇锋湡寰咃紒鐩爣鏄細JMeter 鏈夌殑鍔熻兘鍩烘湰閮戒細鏈夛紝骞朵笖瑕佹洿濂界敤銆?/p> -
蹇嵎璋冭瘯锛?br>绫讳技 Postman 鐨勬帴鍙h皟璇曟柟寮忥紝涓昏鐢ㄩ€斾负涓存椂璋冭瘯涓€浜涙棤闇€鏂囨。鍖栫殑鎺ュ彛锛屾棤闇€鎻愬墠瀹氫箟鎺ュ彛鍗冲彲蹇€熻皟璇曘€?/p>
-
浠g爜鐢熸垚锛?br>鏍规嵁鎺ュ彛鍙婃暟鎹暟鎹ā鍨嬪畾涔夛紝绯荤粺鑷姩鐢熸垚鎺ュ彛璇锋眰浠g爜銆佸墠绔笟鍔′唬鐮佸強鍚庣涓氬姟浠g爜銆?/p>
-
鍥㈤槦鍗忎綔锛?br>Apifox 澶╃敓灏辨槸涓哄洟闃熷崗浣滆€岀敓鐨勶紝鎺ュ彛浜戠瀹炴椂鍚屾鏇存柊锛屾垚鐔熺殑鍥㈤槦/椤圭洰/鎴愬憳鏉冮檺绠$悊锛屾弧瓒冲悇绫讳紒涓氱殑闇€姹傘€?/p>
鐪嬪埌杩欓噷锛屾槸涓嶆槸寰堝績鍔紝閭e氨鍔ㄦ墜瀹炶返璧锋潵鍚с€?/p>
涓夈€佺畝鍗曚娇鐢?/span>
1銆佷笅杞藉畨瑁?span class="mq-81">
鍙互浠巋ttps://www.apifox.cn/涓嬭浇锛孉pifox鏀寔linux銆乵ac銆亀indows骞冲彴銆傚彲鏍规嵁鑷韩鎯呭喌閫夋嫨瀹夎銆?/p>
2銆佸熀鏈娇鐢?span class="mq-85">
瀹夎鎴愬姛鍚庯紝棣栨鍚姩闇€瑕佹敞鍐岀櫥褰曪紝濡備笅鍥炬墍绀猴細
3銆佺幆澧冪鐞?span class="mq-89">
鐧诲綍鎴愬姛鍚庯紝apifox榛樿缁欎簡瀹犵墿鍟嗗簵鐨勭ず渚嬶紝鐣岄潰椋庢牸鍜宲ostman鏈変簺鐩镐技銆?/p>
杩欓噷鎴戜滑鍏堝缓涓幆澧冿紝浠ユ垜鏈湴鎺ュ彛鏈嶅姟涓轰緥,鍏蜂綋鍙傝€冩楠ゅ涓嬶細
3.1銆佺偣鍑诲彸涓婅閿娇鐘惰缃寜閽紝濡備笅鍥炬墍绀恒€?/p>
3.2銆佸脊鍑虹幆澧冪鐞嗛€夐」鍗★紝鐐瑰嚮鍙充晶鏂板缓鎸夐挳锛屽涓嬪浘鎵€绀恒€?/p>
3.3銆佹寜鐓ц〃鍗曢€愰」渚濇杈撳叆鐜鍚嶇О鈥滄湰鍦癆PI鈥濄€佸墠缃甎RL鈥渉ttp://localhost:8888鈥濓紝杈撳叆濂斤紝鐐瑰嚮淇濆瓨鍗冲彲锛屾垚鍔熷涓嬪浘鎵€绀猴細
3.4銆佸湪榛樿鍒嗙被涓嬮潰鍒涘缓涓€鏉$敤渚嬶紝濡備笅鍥炬墍绀猴紝杈撳叆瀹岋紝鐐瑰嚮淇濆瓨鍗冲彲銆?/p>
杩欎竴姝ュ浜庡仛杩囨帴鍙f祴璇曠殑鍚屽鏉ヨ锛屽簲璇ヤ笉浼氶檶鐢燂紝姝ゅ涓嶅仛杩囧鎻忚堪浜嗐€?/p>
3.5銆佽皟鐢ㄦ帴鍙o紝淇濆瓨鎴愬姛鍚庯紝鍒囨崲鑷宠繍琛岄€夐」鍗★紝閫夋嫨鏈湴鐜锛岀偣鍑诲彂閫侊紝璋冪敤鎴愬姛濡備笅鍥炬墍绀猴細
鍒版锛屽叧浜嶢PIfox鐨勭畝鍗曚娇鐢ㄤ粙缁嶅畬姣曘€?/p>
鍥涖€佷釜浜哄枩娆㈢殑鍔熻兘
-
鍥㈤槦鍗忎綔娴佺▼锛?
鍓嶇銆佸悗绔殑瑙勮寖鍙婃祦绋嬩綋绯伙紝闈炲父鍊煎緱鍊熼壌銆?/p>
-
鑴氭湰鍔熻兘锛?
棰勬墽琛屻€佸悗鎵ц鑴氭湰銆佽剼鏈殑澶嶇敤鏂归潰锛屽苟鏀寔鏂█娴嬭瘯锛岃剼鏈娉?00%鍏煎 Postman鑴氭湰璇硶銆?/p>
-
Mock 鍔熻兘锛?
鍒涘缓mock鏁版嵁锛屾尅鏉挎暟鎹殑瀹炵幇锛屽墠鍚庣鍒嗙寮€鍙戠殑鍒╁櫒銆?/p>
-
浠g爜鐢熸垚鍔熻兘锛?
鏍规嵁鎺ュ彛妯″瀷瀹氫箟锛岃嚜鍔ㄧ敓鎴愬悇绉嶈瑷€/妗嗘灦鐨勪笟鍔′唬鐮侊紙濡?Model銆丆ontroller銆佸崟鍏冩祴璇曚唬鐮佺瓑锛夊拰鎺ュ彛璇锋眰浠g爜銆?/p>
鏇撮噸瑕佺殑鏄細浣犲彲浠ラ€氳繃鑷畾涔変唬鐮佹ā鏉挎潵鐢熸垚绗﹀悎鑷繁鍥㈤槦鐨勬灦鏋勮鑼冪殑浠g爜锛屾弧瓒冲悇绉嶄釜鎬у寲鐨勯渶姹傘€?/p>
-
鏀寔娴嬭瘯濂椾欢鍔熻兘锛?
閫氳繃鍒涘缓娴嬭瘯鐢ㄤ緥闆嗛€夋嫨宸蹭繚瀛樻祴璇曠敤渚嬶紝涓烘帴鍙h嚜鍔ㄥ寲娴嬭瘯鍙婃寔缁泦鎴愶紙鍦ㄥ紑鍙戜腑锛夊仛鍑嗗銆?/p>
浜斻€佸啓鍦ㄦ渶鍚?/span>
鐪嬪埌杩欓噷锛屾槸涓嶆槸鏇村姞蹇冨姩鍜岃穬璺冩璇曚簡鍛€?br>
褰撶劧锛岃繕鏈夊緢澶氬叾浠栧姛鑳斤紝鎰熷叴瓒g殑鍚屽锛屽彲浠ヨ嚜宸辩户缁帰绱€?/p>
鎻愰啋涓€涓嬩綘韬竟闇€瑕佺殑鏈嬪弸~
鐗堟潈褰掕蒋浠舵祴璇曞悰鎵€鏈?/span>
娆㈣繋鍚岃杞浇寮€鐧?/span>
浣滆€匑绯栧皬骞?/span>
缂栬緫@绯栧皬骞?br class="mq-185">
鍥剧墖@绯栧皬骞?/span>
鍟嗗姟鍚堜綔璇疯仈绯诲井淇★細sofeicoffee
以上是关于鎺ュ彛娴嬭瘯绁炲櫒Apifox的主要内容,如果未能解决你的问题,请参考以下文章
Dubbo鎺ュ彛涓嶇煡閬撴€庝箞娴嬶紵鏁欎綘涓夎浠g爜瀹炵幇dubbo鎺ュ彛娴嬭瘯