Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In the last few meters we have learned about the basics of unit testing in flutter and we are now ready
to test a class that is a little bit more complex than the non empty string validator and in the process
of doing this we will learn a bit more about the flutter testing API.
So as a next step we can open the four month class that we use to format our words dates and currency
values in the up.
And then we can add a new Dart file called for format on the score fast inside the test packets.
And like we have done before we can import faster test and we can also add a void Main method like this
and to make our life easier.
We can split up what Ed into and keep the did testify on the left and the file that we want to test
on the right.
And as we can see here we have four different methods and we could write multiple tests for each of
them.
So it would be nice if somehow we could group the tests that belong together.
And it turns out that we can do that by using a test group so we can type being group like this without
description.
And here we could type being ours and then we need to pass a closure like this.
And inside the body of this closure we cannot.
All the tests for this method.
So let's start with the first one.
And here I can type test a description of positive and then inside the test body.
I'm going to write expect that for month and I need to import this second draft format that house with
a parameter of 10 for example is equal to 10 H which is the string representation that I want and if
I want I can already run this test and as I can see.
Now this is green.
So we can continue.
Next I want to add more tests and I'm particularly interested in what happens when we pass zero.
When we pass on negative value and when we pass a decimal number so let's up this test quickly and I
can copy and paste this method in here I can rename the description to zero and I can pass for month
of ours with zero and I expect zero H and then I can do the same thing for the negative case.
And here I could pass for example hours of minus five and I'm still going to expect to see zero hours
because this is how this logic was implemented.
Finally I cannot the decimal case so I can copy paste this I'm going to name this decimal and I'm going
to pass a value of 4.5 an unexpected value of 4.5 H and then I can run all the tests again and I can
see that they have all passed.
OK so let's continue on the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.