Course / دورة
Test automationأتمتة الاختبار
Let the machine repeat what you have already proved
دع الآلة تكرّر ما أثبتّه أنت من قبل
intermediate 16 lessons 5 chapters 12 hours
Before you start / قبل أن تبدأ: Software testing , JavaScript in the browser
0 / 16 lessons completed / دروس مكتملة
What you will be able to do / ماذا ستستطيع أن تفعل
- Decide what is worth automating, and say why the rest is not تقرر ما يستحق الأتمتة، وتقول لماذا لا يستحقها ما عداه
- Test an API directly, without going through a page تختبر واجهة برمجة مباشرة، دون المرور بصفحة
- Write a browser test that does not fail at random تكتب اختبار متصفح لا يرسب عشوائيًا
- Read a failing test and know whether the product or the test is wrong تقرأ اختبارًا راسبًا فتعرف: أالمنتج خاطئ أم الاختبار؟
1 Why automateلماذا نؤتمت 3
-
1
What automation is actually for / ما الغرض الحقيقي من الأتمتة
Automated tests do not find bugs. They notice when something that used to work has stopped working — which is a narrower job than most people expect, and the reason automation frees a tester rather than replacing one.
الاختبارات الآلية لا تجد الأخطاء. بل تلاحظ حين يتوقف عن العمل شيء كان يعمل — وهذه مهمة أضيق مما يتوقعه معظم الناس، وهي سبب كون الأتمتة تحرّر المختبِر لا تستبدله.
-
2
What not to automate / ما لا يُؤتمت
Every automated test costs something forever: it has to be written, run, and repaired every time the product changes. Deciding what to leave alone is the part of automation that most teams skip, and it is why their suites collapse in year two.
كل اختبار آلي يكلّف شيئًا إلى الأبد: فلا بد أن يُكتب ويُجرى ويُصلَح كلما تغيّر المنتج. واختيار ما يُترك هو الجزء الذي تتخطاه معظم الفرق من الأتمتة، وهو سبب انهيار مجموعاتها في السنة الثانية.
-
3
Where a test should live / أين ينبغي أن يعيش الاختبار
The same check can be written at three levels, and the level decides how fast it runs, how often it lies to you, and how clearly it says what broke. Choosing well is most of what separates a suite people trust from one they ignore.
الفحص نفسه يمكن أن يُكتب على ثلاثة مستويات، والمستوى يقرر: كم يجري سريعًا، وكم يكذب عليك، وكم يقول بوضوح ما الذي انكسر. وحسن الاختيار هو معظم ما يفصل مجموعة يثق بها الناس عن مجموعة يتجاهلونها.
2 Testing an APIاختبار واجهة برمجة 4
-
4
Testing without a page / الاختبار بلا صفحة
Behind most screens is a service that answers questions directly. Talking to it removes the browser, the layout and the waiting from your test — and lets you ask things the interface will not let you ask.
خلف معظم الشاشات خدمةٌ تجيب عن الأسئلة مباشرة. ومخاطبتها تزيل من اختبارك المتصفحَ والتخطيطَ والانتظار — وتتيح لك أن تسأل ما لا تدعك الواجهة تسأله.
-
5
Sending requests by hand / إرسال الطلبات يدويًا
Before you automate an API test you have to be able to send the request once and read the answer. A request tool is the API equivalent of exploratory testing, and it is where every API test you write should start.
قبل أتمتة اختبار واجهة لا بد أن تستطيع إرسال الطلب مرة وقراءة الجواب. وأداة الطلبات هي مكافئ الاختبار الاستكشافي عند الواجهات، ومنها ينبغي أن يبدأ كل اختبار واجهة تكتبه.
-
6
Assertions with teeth / توكيدات لها أنياب
An assertion is where your judgement about what is correct becomes executable. Write it too loosely and the test passes forever while the product decays; too tightly and it fails every week for reasons nobody cares about.
التوكيد هو حيث يصير حكمك على ما هو صحيح قابلًا للتنفيذ. اكتبه فضفاضًا ينجح الاختبار إلى الأبد بينما يتحلل المنتج؛ واكتبه ضيّقًا يرسب كل أسبوع لأسباب لا يبالي بها أحد.
-
7
Collections, variables and secrets / المجموعات والمتغيرات والأسرار
The same twelve requests have to run against your machine, the test server and staging, without anyone editing twelve URLs — and without a real password ever being written into a file that gets shared.
الطلبات الاثنا عشر نفسها يجب أن تجري على جهازك وعلى خادم الاختبار وعلى بيئة التجهيز، دون أن يحرّر أحد اثني عشر رابطًا — ودون أن تُكتب كلمة مرور حقيقية قط في ملف يُشارَك.
3 Driving a browserقيادة المتصفح 3
-
8
How a machine uses a browser / كيف تستخدم الآلة متصفحًا
A browser test is a program that opens a real browser and works it like a very fast, very literal person. Understanding that it is literal — and what it cannot see — is what stops you expecting things of it that it will never do.
اختبار المتصفح برنامج يفتح متصفحًا حقيقيًا ويشغّله كإنسان سريع جدًا وحرفيّ جدًا. وفهم أنه حرفيّ — وما الذي لا يستطيع رؤيته — هو ما يمنعك من توقّع أشياء لن يفعلها أبدًا.
-
9
Finding things the way a person would / إيجاد الأشياء كما يجدها الإنسان
How you find an element decides whether your test survives next month. Locators tied to the page's structure break when anyone touches the markup; locators tied to what the user sees break only when the product genuinely changes.
طريقة إيجادك للعنصر تقرر: أينجو اختبارك الشهر القادم؟ فالمحدِّدات المربوطة ببنية الصفحة تنكسر حين يمسّ أحدٌ الوسوم؛ والمربوطة بما يراه المستخدم لا تنكسر إلا حين يتغير المنتج حقًا.
-
10
Waiting, and the flaky test / الانتظار، والاختبار المتقلّب
A flaky test is one that passes and fails without the product changing. It is the single thing most likely to destroy a team's trust in automation, and almost all of it comes from one mistake: acting before the page is ready.
الاختبار المتقلّب هو الذي ينجح ويرسب دون أن يتغير المنتج. وهو أكثر شيء يُرجَّح أن يهدم ثقة فريق بالأتمتة، وجُلّه يأتي من خطأ واحد: التصرّف قبل أن تكون الصفحة جاهزة.
4 Tests that lastاختبارات تدوم 4
-
11
The shape of a readable test / شكل الاختبار المقروء
Every test is three parts in the same order: get ready, do the thing, check the result. Writing them as three visible blocks makes a failure legible at a glance, six months after you wrote it and forgot it.
كل اختبار ثلاثة أجزاء بالترتيب نفسه: تجهّز، وافعل الشيء، وافحص النتيجة. وكتابتها ثلاث كتل ظاهرة تجعل الرسوب مقروءًا بنظرة واحدة، بعد ستة أشهر من كتابتك له ونسيانك إياه.
-
12
Every test on its own / كل اختبار قائم بذاته
A test that needs another test to have run first is not a test, it is step four of a procedure. Independence is what lets a suite run in any order, in parallel, and tell you the truth when one thing breaks.
الاختبار الذي يحتاج إلى إجراء اختبار آخر قبله ليس اختبارًا، بل الخطوة الرابعة من إجراء. والاستقلال هو ما يتيح للمجموعة أن تجري بأي ترتيب، وعلى التوازي، وأن تقول لك الصدق حين ينكسر شيء واحد.
-
13
Keeping the locators in one place / حفظ المحدِّدات في مكان واحد
When forty tests each contain their own copy of the same locator, a renamed button is forty edits. Putting the page's vocabulary in one file makes it one — and makes the tests read like sentences.
حين يحوي أربعون اختبارًا كلٌّ منها نسخته من المحدِّد نفسه، يصير زرٌّ أُعيدت تسميته أربعين تعديلًا. ووضع مفردات الصفحة في ملف واحد يجعلها تعديلًا واحدًا — ويجعل الاختبارات تُقرأ جملًا.
-
14
Reading a red build / قراءة بناء أحمر
A failing automated test asks one question before any other: is the product wrong, or is the test wrong? Answering that quickly and honestly is what makes a tester trusted, and answering it lazily is how suites get abandoned.
الاختبار الآلي الراسب يطرح سؤالًا قبل كل شيء: أالمنتج خاطئ أم الاختبار؟ والإجابة عنه بسرعة وصدق هي ما يجعل المختبِر موثوقًا به، والإجابة عنه بكسل هي كيف تُهجَر المجموعات.
5 Running themإجراؤها 2
-
15
Running without you / الإجراء من غيرك
A test suite that only runs when someone remembers is barely a suite. Continuous integration is a machine that runs it on every change, and the value is entirely in how fast it tells somebody, and whether they believe it.
مجموعة اختبارات لا تجري إلا حين يتذكر أحد بالكاد تكون مجموعة. والتكامل المستمر آلة تجريها عند كل تغيير، وقيمتها كلها في سرعة إخبارها أحدًا، وفي هل يصدّقونها.
-
16
Project: automate one real journey / مشروع: أتمتة رحلة حقيقية واحدة
One journey, automated properly: chosen for a reason you can defend, written so it does not flake, and proved to fail when it should. This is the piece of work that shows you can be trusted with a suite.
رحلة واحدة، مؤتمتة كما ينبغي: مختارة لسبب تستطيع الدفاع عنه، ومكتوبة بحيث لا تتقلّب، ومثبَت أنها ترسب حين ينبغي. وهذا هو العمل الذي يُظهر أنه يمكن ائتمانك على مجموعة.