All language subtitles for 382 Writing the first unit test.en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In this video we will start looking at how we can write unit tests for our application and when we work

with flutter projects.

There is a convention that all tests are stored inside a folder called Test which is located at the

root of our project and if we open this folder we can find a single file called.

We did that dot dart and this is an example we did test that is added when we create a new flatter project

and we will look at.

We did tests later on.

So for now we can go ahead and delete this file.

Next we want to create our first unit test.

And since we already have a complete up we need to choose what we want to test.

And I suggest that we start with something simple.

For example we could open the signing folder and in here we have these validators that that file.

And as we can see we have unknown empty string validator class that implements one method.

And what this does is return true if the input string is not empty.

So I think this class is a good candidate for our first test.

So we're going to select the test folder.

And here we can create a new Dart file called Mali datas on this core test.

They'll start.

And next we can start writing some code.

And the first thing that we want to do is to create that void Main method which is the entry point for

all the tests in this file.

And the other thing that we need to do is to import a file called flatter test like this.

And now that we have done this we can start writing our first test and we do this by calling a method

called test.

And this takes up description which is a string and also closure which represents the body of our test.

But what is it that we want to test.

Exactly.

Well we can open the non empty string validate or class.

And I think our good first test would be to verify that the IS valid method returns true when we pass

an on empty string.

So let's implement this back to our test file.

We cannot.

A description that says no an empty string and inside the body I'm going to order final validate all

equals an empty string pollinator like this.

And I need to remember to import this.

And then we want to write an expectation.

So I'm going to type in some code and then I'm going to explain it.

So here I can I expect and then validator dot is valid with test.

And then through like this.

Okay.

So how does this work.

Well by adding this code to expect we are writing an assertion that checks that the value returned by

the first argument matches the value that we pass to the second argument.

And this entire expression is something that we can almost read in plain English because we are expecting

that validator that is valid means test is true.

And now that we have written our first test we can execute it.

So let's do that in the next video.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.