مقدمة
مرحبا هبر! في هذا البرنامج التعليمي ، أريد التحدث عن الوظائف الأساسية لإطار عمل مثل Cucumber واستخدامه لإنشاء اختبارات تلقائية لواجهة المستخدم على أجهزة iOS المحمولة.
هدفي هو جعل الوصف بسيطًا ومفهومًا قدر الإمكان لمعظم القراء ، بغض النظر عن مهارات البرمجة أو التشغيل الآلي. بشكل عام ، هناك الكثير من المعلومات حول BDD و Cucumber على الشبكة ، لذلك ، لتجنب التكرار ، لا أريد التعمق في النظرية العامة ، لكنني سأركز على الجمع بين إطار العمل و iOS.
ستكون هذه المقالة ذات أهمية ، أولاً وقبل كل شيء ، لأولئك المختبرين الذين بدأوا للتو في تعلم عالم الاختبارات التلقائية. سيكون لديهم تعليمات مفصلة حول كيفية نشر الخيار ، بالإضافة إلى مثال مفصل لكتابة الاختبار الأول. بالنسبة للمستخدمين ذوي الخبرة الذين ليسوا على دراية بهذه الأداة ، ستقدم المقالة فكرة عامة عن Cucumber ، وربما تساعد في الاختيار لصالح إطار الاختبار هذا (جيدًا ، أو العكس - آخر).

بضع كلمات عن غيركين والخيار و BDD
Gherkin PO, - . «» Gherkin , - , (Given-When-Then-And) //.
Cucumber - , behavior driven (BDD) , Gherkin.
BDD (behavior driven development) - , - . BDD :
Scenario: Login with PIN
Given the app is running
And I'am registered user
And I see Login screen
When I enter 4-digits PIN
Then I am logged in, , , , . .
Cucumber
Cucumber iOS semi-official (-?) .
Cucumber - ocoaPod , . CocoaPod
sudo gem install cocoa podspod init. , :
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'
use_frameworks!
inhibit_all_warnings!
def test_pods
pod 'Cucumberish'
end
target ‘__CucumberTests’ do
test_pods
end
- , . ,
XCFit
sudo gem install xcfitXcode, , cucumberish bundle. CucumberTests . Features
build phases CucumberTests, Copy Bundle Resources, Compile Sources Link Binary With Libraries
Xcode,
pod install.xcworkspace , . Screens, Step Definitions Supporting Files. - Add Files to.
, Cucumber!
( 2020) « » - . , . Xcode :
@objcclass func CucumberishSwiftInit()var elementQureyvar elementQueryexpectedMenuCount: uInt = uInt(menuCount)!expectedMenuCount: Int = Int(menuCount)!expectedCellCount: uInt = uInt(cellCount)!expectedCellCount: Int = Int(cellCount)!
. ⌘+U . , , «Tests successfully executed 0 from 0». , , , , .
" "
Cucumber :
Features - .feature, BDD . , Gherkin, ,
< >CucumberTests.swift . , Given , . . , , ,
Screens - .swift , ,
Step Definitions - .swift ,
Common - commonStepDefinitions.swift , , ( , ..)
. .feature , Features, , beforeStart CucumberishSwiftInit()
?
, . , , , c Xcode , ⌘+U.

:
/
-
Given And . Given , Given-And-And-…

swift , . , :

«The app is running» , .
Given When Then , . .swift Step Definitions
. -, , -
, , , :
feature Features. :
Feature:…
In order to …
As a …
I want to … feature , Gerkin
swift Given
step definition
Given
«the app is running» . , - «», Given-And-And-… . , .

- . , , , .
, , , «My credentials», .
. , , .

, , «Get started». , , «0000»,

, , , , , . «0000».
UIInterruptionMonitor, , (faceid ) .
, / , «My credentials». ,

, credentialList , , . , , "Delete" "Delete credential".

. , «My credentials».
CommonStepDefinitions
Given-, .
CommonStepDefinitions.swift. Common , , .
, Menu, Confirm Deny, «Please confirm». , , , step definitions . CommonStep :
…
And I see the "Menu" view
And I see "Confirm" button
And I see "Deny" button
And I see "Please confirm" text
…common , , :

common , . , - . step definitions accessibility identifier.
, BDD definition, ⌘+U. , , , ( ) executeFeatures .swift .
, - , , - , .
. , 50+ 5 . 5- 45 , . , 10 , , .
- ( «I have no credentials»). , .
Xcode . . .

. .
?
cucumber , , BDD . .
- , . , , 3-4 . , -, , BDD-. , BDD . ? ? cucumber .
, BDD PO -- , , Jira - .
, - , PO , , , , . step definitions .
, , , , , .
, , UI- Cucumber. , , .