@kulboi4real If you have to think of test cases for TDD. I am sorry but either one of two things are wrong.

1) The top-level functional requirements aren’t properly done and/or understood by the team or software engineer working on it

2) You don’t know how to translate requirements to tests
@kulboi4real Translating takes understanding of what’s important to the success of that functionality.

For instance How would you test a React component OR a web route on the backend in the context of the business rules that make it function ?

There’s a simple trick to this and I’ll share
@kulboi4real Now, even though test design is a manual process, it is still a logical one too. Same for Unit/Integration tests.

Don’t focus on behavior and properties of the single software artifact/unit you’ve just built. Focus on the output under given conditions that match the requirements
@kulboi4real Let me break it down a bit more:

For each top-level functional requirement, you are focused on the output under given condition(s). Which is why we use the term “Assertion”.

Assertions are the result of combining condition(s) with output. They are the lifeblood of tests
@kulboi4real Tests (Test cases) have a basic structure

Condition(s)
^
|
|
Input——> (Software artifact) ——> Output
@kulboi4real The reason I put up the figure above (diagram of a Test case) ☝🏾 (check the tweet preceding this one) is because that is the pattern you need to fit a React component OR web route action class method or any software unit into. E.g A react component recieves input and gives output
@kulboi4real The output is supposed to change (or remain the same) under given conditions. Remember, I said focus on output and conditions (a condition could be the data type of the input or passing no input at all to software artifact/unit)

Let me give a real-life example:

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Professional Okpa Handler

Professional Okpa Handler Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @isocroft

29 Jan 20
Having problems with #CORS (Cross Origin Resource Sharing) almost every time ?
Wondering why you mostly always run into a blocked request ?

Remember that it's all about 3 rules that aren't mutually exclusive.

I'll be writing about them in 10 mins time (don't miss it)

#Thread
What is CORS ?

Simply defined as a access control security restriction that is used to limit cross-domain communication based on the origin of a web site or app.

The key word here is Access Control - which is about authorization of http requests

#Thread \1
Another key word is Origin: the origin is based off a combination of 2 things

1. A Scheme /Protocol( http / https )
2. A Host/Sub+Top Level Domain ( google.com )

Ok ? Cool!

Now you ask

How does this CORS thing actually work ?

#Thread \2
Read 20 tweets
28 Oct 19
I know you have heard of password #Salts which are similar to Nonces and used to add uniqueness to passwords and protect against pre-computed hashes (rainbow tables).

Did you also know about password #Peppers ? They are equally important too.
In modern web applications of today, you should #Pepper your passwords as well as #Salt them too before hashing them. Here is the order:

Original Password ---> Salt ---> Pepper ---> Hash ---> Store-In-DB.

However, if you #Pepper passwords wrongly. It could be very disastrous!
What do i mean by this ?

Well, the simplest (and safest - very important) way to #Pepper a password is to HMAC(Original_Password, key) it.

HMACs are resistant to length-extension attacks & brutes-force attacks.

There must be a #Pepper key used for the HMAC too
Read 16 tweets
22 Oct 19
Finally, when you are building a #PWA & setting up a service worker, this is how i feel your fetch event handler should be to handle a myriad of edge cases:

Part 1:
This part shows a CACHE FIRST LOOKUP. Also notice when the app is offline. Setup fetch to work with the HTTP cache
Part 2:
This part show a NETWORK NEXT LOOKUP. We detect errors with the fetch request first and return early. Then detect server-sent events and return too. Then split the by content type: html,css,js,svg responses gets put in the cache and json responses gets put in IndexedDB.
Notice this area: it helps us handle cache eviction gotchas that might hit us when developing a PWA

Don't worry the navigator object is very well accessible inside both Web Workers & Service Workers.

Notice how persist the cache after updating with `cache.put()`
Read 6 tweets
26 Sep 19
So, my thread on how to choose databases for your web apps starts in 20 minutes time. Hope y'all are ready ?However, this time i would love it to be an interactive session where we can learn from each other about database preferences for specific web apps and the use case
#thread
This is what we want to talk about today. Take a really good look at the image below. Study it well. Also notice the words at the 3 vertexes of the triangle. CONSISTENCY, AVAILABILITY & PARTITION-TOLERANCE (Big English - but fear not, we shall demystify all and it'll all be easy)
If we also look at the image in the previous tweet on this thread we can see some popular databases placed at certain sides of the triangle. It is important to note also the positioning of some of a particular point on each side. We shall discuss this in more detail soon. #thread
Read 48 tweets
10 Sep 19
Okay, so tomorrow is the day i do the thread on regular expressions. I will do the thread on everything on regexes for 2 popular languages : #Javascript & #Python. So, stay tuned for tomorrows tweets starting at around midday

cc @NellyTadi @Jayydubby @Patrick01_Codes
@NellyTadi @Jayydubby @Patrick01_Codes So sorry for the delay guys;

So, today i am going to be talking about regexs or regular expressions and how formulate them in 2 programming languages. We are going to start with the basics and from there we will look at the meta syntax combinations that come together to make...
...it possible to perform matches on strings (matching sequences) using patterns (formed by meta characters / meta syntax).

Regular Expressions are sequence of characters that define a pattern that is always finite, unambiguous or unaffected by context.
Read 23 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!