आरईएसटी एपीआई परीक्षण के लिए ककड़ी सुविधा चरणों को लिखने की कोशिश कर रहा है।आरईएसटी एपीआई परीक्षण ककड़ी कदम सर्वोत्तम अभ्यास
मैं जो दृष्टिकोण है यकीन नहीं है बेहतर:
Given I log in with username and password
When I add one "tv" into my cart
And I check my cart
Then I should see the item "tv" is in my cart
या
Given the client authenticate with username and password
When the client send POST to "/cart/add" with body "{item: body}"
Then the response code should be "200"
And the response body should expect "{success: true}"
When the client send GET to "/cart"
Then the response code should be "200"
And the response body should expect "{"items": ["tv"]}"
वहाँ किसी भी सम्मेलन है, जब लोग बाकी एपीआई के लिए ककड़ी चरणों लिखने की कोशिश कर पालन करने के लिए है?
हालांकि मैं सामान्य विचार के लिए इसे ऊपर उठा रहा हूं, मुझे लगता है कि ट्रिपल-उद्धृत JSON (या रूबी, या इसी तरह) आमतौर पर ककड़ी के चरणों के लिए बहुत कम स्तर है। मैं जल्द ही चाबियों और मूल्यों की एक तालिका का उपयोग करता हूं, हालांकि निश्चित रूप से नेस्टेड डेटा को बहुत अच्छी तरह से संभालने का नकारात्मक हिस्सा नहीं है। –
आप पूरी तरह से सही हैं ... मैं एक टेबल पर स्विचिंग कर रहा हूं और प्रत्येक टेबल पंक्ति के लिए FactoryGirl.create को कॉल कर रहा हूं ... इसे जांचें: whitneytaylorimura.wordpress.com –