Cucumber : Advantages and Disadvantages
Cucumber is a testing tool that I have been exposed to since
about May 2013. After a solid 7 months of using this on a daily basis I grown
to I actually quite like it.
Cucumber is written in a behavior driven development (BDD)
and is used with the scripting language Ruby, which is awesome check out my
previous blog post. But you can also use
it with different platforms , but I highly suggest ruby.
Moving on.
Let’s talk about the structure of cucumber really quickly.
Here we have a very very basic structure of cucumber. All of
these files are required to run your tests. The env.rb is the very first file
that is ran when cucumber is executed.
If you have any set up that needs to happen before the initial test is
started this is the place to do that. Then you have your feature file and step
definitions which are explained further down.
Cucumber is written using the syntax of gherkin. * I see
what you did there* Gherkin is a natural language for testing. Natural language,
meaning that it’s readable and understandable to those who don’t program.
EX:
Given I go to “www.google.com”
And you search
for “Technical Hannah”
When the search
is shown
Then I click on
Hannahs blog
BOOM. There you go, nothing too difficult. So gherkin is saved
in what is called a feature file. These are the files that cucumber looks for
when ran. A feature file looks like the following :
@tag
Feature: Teaching Cucumber
Scenario
: Search for Technical Hannah on Google
Given I go to “www.google.com”
And you search for “Technical
Hannah”
When the search is shown
Then I click on Hannahs blog
It’s as easy at that. Now you might notice a few new things
added here. The “ @tag” the “feature” and the
“scenario”.
Tags are used to call feature files. You can only have one
feature per feature file. But you can have many scenarios under one feature.
Not too complicated. You can even put tags over certain
scenarios in your feature file if you only want to run that certain scenario.
So if I were to travel to my cucumber file on my computer
and run cucumber it would look something like this. (note that when you do this
it executes ALL feature files under the feature file folder)
C:\cucumber> cucumber
You can implement step definitions
for undefined steps with these snippets:
Given(/^I go to
"(.*?)"$/) do |arg1|
pending # express the regexp above with the code you wish you had
end
And(/^you search for
"(.*?)"$/) do |arg1|
pending # express the regexp above with the code you wish you had
end
When(/^the search is shown$/) do
pending # express the regexp above with the code you wish you had
end
Then(/^I click on "(.*?)"$/)
do |arg1|
pending # express the regexp above with the code you wish you had
end
Cool , we now have our step definitions that will execute
our cucumber file. Notice that when I created the feature file there were
quotations around some of the words inside the feature. When the step
definitions are created those are seen as variables. This makes it easier to
reuse code in your testing system , this is one of my favorite parts about
cucumber. If we go back to the feature file we just have to change the
variables to anything that we want and the ruby that you've associated with
your step definitions should execute correctly.
After you run your tests your test results will show up
inside of the command prompt.
Why cucumber is
awesome :
1.
Upper level management can read it and it will
make sense to them.
2.
Quick and easy set up and execution
3.
Efficient testing
Why Cucumber is
not-so-awesome:
1.
I have yet to figure out a way to pass variables
between the different lines of gherkin.
2.
Causes the tests to run slower which can be a
pain when trying to figure out the execution time of a program.
Overall Cucumber is awesome. It’s a really rad testing tool
and I highly suggest you use it if you can. If you need to learn ruby to use
it. DO IT!! Ruby is a quick and easy language to learn and it’s fairly powerful
when partnered with cucumber.
Happy testing J
ReplyDeleteAfter reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in
Selenium training in Chennai
no deposit bonus forex 2021 - takipçi satın al - takipçi satın al - takipçi satın al - takipcialdim.com/tiktok-takipci-satin-al/ - instagram beğeni satın al - instagram beğeni satın al - google haritalara yer ekleme - btcturk - tiktok izlenme satın al - sms onay - youtube izlenme satın al - google haritalara yer ekleme - no deposit bonus forex 2021 - tiktok jeton hilesi - tiktok beğeni satın al - binance - takipçi satın al - uc satın al - finanspedia.com - sms onay - sms onay - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - perde modelleri - instagram takipçi satın al - instagram takipçi satın al - cami avizesi - marsbahis
ReplyDeleteucuz takipçi
ReplyDeleteucuz takipçi
tiktok izlenme satın al
binance güvenilir mi
okex güvenilir mi
paribu güvenilir mi
bitexen güvenilir mi
coinbase güvenilir mi
Graton Resort & Casino - Mapyro
ReplyDeleteFind your way around 보령 출장마사지 the casino, find a game area and get directions. A number of 수원 출장마사지 different 전라북도 출장안마 casino game shows 대구광역 출장안마 the location of 계룡 출장샵 the casino,
perde modelleri
ReplyDeletesms onay
mobil ödeme bozdurma
nft nasıl alınır
ANKARA EVDEN EVE NAKLİYAT
Trafik Sigortası
Dedektor
HTTPS://KURMA.WEBSİTE/
Ask kitaplari
çekmeköy beko klima servisi
ReplyDeletemaltepe alarko carrier klima servisi
kadıköy alarko carrier klima servisi
maltepe daikin klima servisi
kartal beko klima servisi
beykoz lg klima servisi
üsküdar lg klima servisi
beykoz alarko carrier klima servisi
üsküdar alarko carrier klima servisi