程序代写 Chapter 1

Chapter 1
Written by

Copyright By PowCoder代写 加微信 powcoder

I’VE HEARD ABOUT TESTING, BUT…
What exactly is testing?
What types of tests exist?
Why bother writing automated tests?

BASICALLY…
TESTING IS A PROCESS OF VALIDATING THE SOFTWARE TO ENSURE THAT IT’S NOT BROKEN.

BUT WHY DOES SOFTWARE BREAK?

SOFTWARE TENDS TO GET MORE AND MORE COMPLEX
Software helps solve
problems, and that’s
why we people keep
building and using it.
Real-world problems may
be difficult and
operate vague entities.
Software too.

ANY LARGE ENOUGH SYSTEM HAS HACKS
Sometimes, hacks are
just okay. A nice hack
can dramatically
improve performance, or
save some RAM, or help
you ship a complex
feature earlier and
make your customers
Yet, hacks often make
use of something in a
totally unexpected and
unsafe way.

COMPUTERS DON’T UNDERSTAND US AND THE WORLD AROUND
Computers don’t solve
people’s problems just
by existing. We tell
computers what to do
with all these weird
instructions written in
special languages.
Sometimes, we can’t
translate our thoughts
into these languages
correctly.

PEOPLE MAKE MISTAKES
People are smart, but
there’s always a chance
of mistake.
Didn’t sleep well?
Your code will crash.
Slept well?
Your code still will
Maybe, you simply
haven’t considered
another use case.

YOUR CODE IS NOT THE ONLY THING THAT HAS ERRORS
The lines of code that
you write don’t get
executed on the CPU
There’s also a
framework, a compiler,
runtime libraries, an
operating system, HAL,
and hardware that
consists of billions of
tiny transistors.

SOMETIMES, ERRORS CAN COST TOO MUCH
Some software bugs resulted in the loss of billions dollars and even human deaths.
Not handling a null
pointer properly is one
of billion dollar

HENCE, WE HAVE TO MAKE SURE THAT OUR CODE DOES EXACTLY WHAT WE EXPECT IT TO DO, AND THE ENTIRE PRODUCT BEHAVES IN THE WAY WE WANT IT TO BEHAVE. THIS IS CALLED TESTING.

TESTING ISN’T A SPONTANEOUS AND RANDOM PROCESS.
IT IS A SYSTEMATIC AND DELIBERATE ACTIVITY THAT AIMS TO DETECT AND DOCUMENT BUGS AND REGRESSIONS TIMELY BEFORE THEY GET RELEASED TO USERS.

DEVELOPING RELIABLE HIGH- QUALITY SOFTWARE IS NOT ABOUT ALWAYS WRITING FLAWLESS CODE, IT’S ABOUT DETECTING THE POSSIBLE ISSUES IN TIME AND MAKING SURE THEY’RE FIXED BEFORE THEY WOULD EVER AFFECT CUSTOMERS.

WRITING CODE
PROPERLY TESTING THE FEATURES
FIXING THE ISSUES TIMELY
RELIABLE SOFTWARE

FROM THE TESTING PERSPECTIVE, USE CASES AND USAGE SCENARIOS IMPLEMENTED IN THE SOFTWARE PRODUCT ARE CALLED TEST CASES, OR TEST SCENARIOS.

A TEST CASE IS AN ACTION THAT CHECKS FOR A SPECIFIC OUTCOME OF THIS ACTION.
‘WHEN I’VE ENTERED MY USERNAME AND PASSWORD, THE SUBMIT BUTTON GETS ENABLED’

A TEST SCENARIO IS A SET OF FUNCTIONALITY OR FEATURES TO VERIFY.
‘LOGGING IN WITH A USERNAME AND A PASSWORD WORKS’

IF WE CHECK A TEST CASE OR TEST SCENARIO AND THE SOFTWARE WORKS AS WE’VE EXPECTED, WE SAY THAT IT ‘PASSES’ THE TEST CASE OR TEST SCENARIO.
OTHERWISE, WE SAY THAT IT ‘FAILS’ IT.

TOGETHER, TEST CASES AND TEST SCENARIOS DEFINE A FUNCTIONAL SPECIFICATION OF A SOFTWARE PRODUCT.

THUS, WHILE BEING A FEEDBACK INSTRUMENT, TESTING ISN’T LIMITED TO JUST A BUG DISCOVERY TOOL.
IT ALSO HELPS UNDERSTAND AND FORMALIZE THE IMPLEMENTED PRODUCT’S BEHAVIOUR AND BRINGS THE IMPLEMENTATION CLOSER TO THE EXPECTATIONS.

HOW DO WE TEST?

https://staging.yourcoolproject.com/
VERY IMPORTANT SOFTWARE
Click the button below to see a funny cat.
MANUAL TESTING
It’s the most obvious
way of testing.
You get the software running somewhere*, and then you start checking each test scenario by hand, ticking off the ones that pass and reporting the ones that fail.

FOR MANUAL TESTING, BETTER DEPLOY THE RELEASE CANDIDATE (A SOFTWARE VERSION THAT IS PLANNED TO BE RELEASED) ONTO AN ENVIRONMENT CLOSE TO THE PRODUCTION. SUCH ENVIRONMENTS ARE USUALLY CALLED ‘STAGING.’

MANUAL TESTING IS CONVENIENT FOR CHECKING THAT A FEATURE YOU’VE BUILT KINDA WORKS.

WHEN A SOFTWARE PRODUCT GROWS AND BECOMES MORE COMPLEX, THE NUMBER OF TEST CASES BECOMES TOO BIG, AND QA PROCESS BECOMES A BLOCKER FOR NEW RELEASES.

WHEN YOU HAVE TO SUPPORT MULTIPLE DEVICES OR PLATFORMS, THE NUMBER OF TEST CASES GETS MULTIPLIED BY NUMBER OF THE DEVICE GROUPS OR PLATFORMS. IT ALSO BECOMES A BLOCKER FOR NEW RELEASES, OR LEADS TO REGULARLY ROLLING OUT AN UNDER-TESTED PRODUCT THAT BREAKS ON CUSTOMER DEVICES.

THE MAIN ISSUE WITH MANUAL TESTING IS THAT IT DOESN’T SCALE.

MANUAL WORK USUALLY DOESN’T SCALE WELL AND NEEDS AUTOMATION.

LUCK THAT SOFTWARE ENGINEERS ARE GOOD AT AUTOMATION.

yourcoolprooject – – -zsh – 100×40
~/projects/yourcoolproject (master) $ npm run test
PASS src/components/components.test.js (0.492s) Your Cool project
Components


Has customizable text

Has customizable text