Tuesday, June 27, 2017

I don't find test-cases very useful

Well, Randall Munroe (the XKCD guy) has it right. Someone wrong on the internet is a great motivator. I was flipping through my reading list, when I encountered an article with the oh-so-daring title "You Don’t Have Test Cases, Think Again". Well - The people at PractiTest blog usually write deep thoughtful posts, so there is probably a catch hiding in the post that will lead to an interesting thought trail. Also, reading through my phone, I casually skipped the warning notice at the top of the page and went on reading. As I read through, it became clear to me that I completely disagree with the content there. Hence - this post here.

Probably the easiest thing would be to be the friendly neighborhood bully and pick up on some of the many mistakes there are in the post that indicates that the author either has no understanding of what exploratory tests are, or  he is using a very private and skewed definition of ET (some candidates are the claim that there is no test planning in ET, the axiom "good tests have well defined and agreed upon pass criteria in advance" or my favorite: "[...]some Exploratory gurus assiduously disdain requirements; so they’re very unlikely to get involved with intermediate development deliverables prior to executable code"), but I prefer to avoid public ranting and patronizing people I don't know, so instead, I'd rather say why I don't think in terms of test cases and why I usually avoid this language.

I'll start with the obvious truth - some of what I do can be described in test-cases language. While I'm "testing" (or "exploring", if you prefer this term) I'm doing a lot of checking that can be translated to test-cases language, as can some of my more vague observations (e.g. "this doesn't look comfortable") could sometimes be translated to a test case without stretching it (in fact, once a problem is spotted, defining a test case around it is usually easy). So, yes - if someone insists, I am "executing test-cases" and I'm doing it wrong in as many ways as shorthand writing is doing calligraphy wrong.
And that's, in short, is the reason I try to avoid using the language of "test cases" - It comes with a lot's of baggage. When I say "test case" I'm also saying "heavy predefined documents" and "step-by-step instructions", which is not what I'm trying to convey. When I talk about my testing, I focus on getting my team to agree on what we should test, on what risks do we want to address and I rely on my skills. During my work I will use checklists, I will review any source of information I have (and get those I need) and have my team review both my intentions and my work. Heck, we've recently spent a full week reformatting data into excel sheet just so that we could deal with an unusually large testing problem. And yet - I don't say "test cases".

Another matter I want to address is the odd dichotomy created between "exploratory testing" and writing a test case. When you think about it closely, it is pretty much the same thing. When I spent some time writing down very detailed test cases, I could never do it without actually having the software and performing it at the same time, and I have yet to meet a tester who wrote a test plan without "winging it". Sure, some of us improvise magnificently using all sorts of techniques  - from equivalence partitioning to combinatorial testing to personas and use cases - but all of that charade is simply masking the fact that we apply our experience, skills and gut feelings to choosing the data and the techniques that will be applied (no, I'm not saying those techniques are a sophisticated fraud, they are valuable, very much so sometimes, but the skilled tester will know when to apply each technique or tool and when not to).
I want to ask you to think of the following question: what would be the result of exploratory testing a requirements document?
...
...
...
...
Done thinking? have your answer? Great. Unless, of course, your answer was "exploratory testing must have a working product to act upon", which is simply wrong. But in any other case, great.
My answer is - test plan. When I test a requirements document (for those who use the ISTQB vocabulary, please recall that a review is a form of a static test), I come up with a model of how the software is supposed to function, with questions pointing at gaps in this model, or inconsistencies in the requirements, I compose a list of risks that we might want to put some safeguards against (some of them may be "test this area once it's done and look for that sort of glitches") and I add my knowledge and experience back to the team. I was definitely testing, and since I was learning about the product during this activity, I would say it falls under the definition of "exploratory" part as well (Also, if we avoid quoting anonymous "gurus" and stick with quotes we can trace, I tend to agree with Bach & Bolton's definition, according to which all testing is exploratory).
So, if we accept that writing a test plan is, in fact, an act of exploratory testing, why do we claim that executing the results is any different? And why do we insist on separating test execution from test planning? Sure, there are cases where we might want to plan more beforehand - to make sure we don't forget or to fight off some of the bias that we might have after testing the same thing for a while, but there are other cases where we might not want to do so. Relying on skilled testing allows us that freedom of doing what we think is right for our project. Which leads us back to why I don't like using the term "test case" - it just draws the focus from what's important.


---------------------------------------
מה יש לומר רנדל מונרו (ההוא מXKCD) ידע על מה הוא מדבר. יש מעט מאוד דברים שגורמים למוטיבציה כמו לראות מישהו טועה באינטרנט. הפעם, רפרפתי דרך רשימת הקריאה שלי כשהגעתי לבלוג של פרקטיטסט ושם היה המאמר עם הכותרת ההו-כה-מבריקה "You Don’t Have Test Cases, Think Again". נו, מילא. בדרך כלל אני מוצא שם פוסטים מרתקים, אז אולי יש פה ניסיון לתפוס את תשומת הלב כדי לגרום לי לחשוב. כמובן, כיוון שקראתי דרך הפלאפון, דילגתי בקלילות מעל האזהרה שהייתה כתובה באותיות של קידוש לבנה בראש העמוד והמשכתי לקרוא - מצפה לרעיון מעניין. ובכן, מהר מאוד הבנתי שמעניין זה לא יהיה, כי כל המאמר מבוסס על חוסר הבנה משווע של (הדרך בה אני חושב שצריך להבין) בדיקות חוקרות, ואפילו של בדיקות בכלל. ולכן (ובדחיפה קטנה מצד יואל) - הפוסט הזה. 

ככל הנראה, הדבר הקל ביותר לעשות יהיה להיטפל למגוון הרחב למדי של טעויות והצהרות יומרניות שאפשר למצוא בפוסט ההוא (כמו הטענה שאין תכנון בבדיקות חוקרות, או ההכרזה שכמה "גורו"אים של בדיקות חקר אלרגיים לדרישות ולכן מעורבים רק ברגע בו יש תוכנה פועלת שאפשר "לחקור"), אבל אני משתדל להשמיץ אנשים שאני לא מכיר רק בקרב חוג חברי הקרובים ומשתדל להיות יחסית מנומס בפומבי, כך שאני רוצה להסתכל על הנושא מזווית אחרת - למה אני לא מתלהב מהשימוש ב"מקרה בדיקה" (המונח העברי כאן בעיקר מטעמי נוחות הכתיבה, בעולם האמיתי אני בדרך כלל נתקל באנשים שאומרים "טסט קייס"). 

קודם כל, הכרה קטנה במציאות כפי שהיא - חלק מהפעילות שלי, ובמיוחד חלק מהפעילות שלי בזמן שאני בודק (ולא, נניח, מכלה את זמני בישיבות, או עובד על פרוייקט צדדי), אפשר לתאר בשפה של מקרי בדיקה. בזמן שאני "בודק" (או "חוקר") את המוצר, אני מבצע לא מעט מבדקים שאפשר לתרגם, פחות או יותר, לשפה הזו. לכן, הטענה הבסיסית של הפוסט ההוא היא פלוס מינוס נכונה - בודקי תוכנה ממשיכים לבדוק תוכנה, והפעילות הבסיסית אליה הובילו מקרי-בדיקה עדיין מתרחשת. אז כן, בהחלט אפשר לומר שאני מבצע מקרי-בדיקה, ושאני עושה את זה לא נכון. לא נכון באותו אופן בו כתב קצרנות הוא ביצוע די עלוב של קליגרפיה. 
וזו, בקצרה, הסיבה בגללה אני לא אוהב את המונח הזה - הוא מגיע עם הרבה יותר מדי מטען. אם אני אומר שאני מבצע "מקרי בדיקה", מה שמשתמע בתוך זה הוא גם כתיבה מראש של ערימת מסמכים גבוהה למדי וגם מתכון של צעד-אחד-צעד שלכאורה אמור להיות שם, וזה בהחלט לא מה שאני מנסה לומר. כשאני מדבר על בדיקות תוכנה, אני מתמקד בלגרום לצוות להסכים על הכיוון ועל הכיסוי שאנחנו מנסים להשיג,להסכים על הדברים שמדאיגים אותנו יותר ואלו שפחות. כשאני מדבר על בדיקות, אחת ההנחות עליהן אני מתבסס היא שמדובר בעבודה לה נדרשת מיומנות. 
במהלך העבודה שלי אני בהחלט עשוי לכתוב לעצמי רשימות, אני סוקר את כל מקורות המידע הרלוונטיים שיש (או שאני צריך ומשיג) ואני מעמיד לסקירה גם את הכוונות שלי (מראש) וגם את מה שעשיתי (בדיעבד), רבאק - בילינו למעלה משבוע בהעברה של נתונים לקבצי אקסל רק כדי שנוכל להתמודד עם משימה אחת שהייתה גדולה במיוחד, ולמרות זאת, אני לא משתמש במונח "מקרי בדיקה". 

אם אנחנו כבר כאן, אני רוצה להתייחס לעוד נקודה שהפריעה לי בפוסט ההוא, והיא החלוקה המשונה בין "בדיקות חוקרות" לבדיקות מתוסרטות. כשעוצרים לחשוב על זה מקרוב, זה פחות או יותר אותו הדבר. בעבר, כשהקדשתי הרבה מאוד זמן לכתיבה של תסריטי בדיקה מפורטים, הדרך היחידה בה יכולתי לעשות את זה הייתה על ידי ביצוע של התסריט במקביל לכתיבה (וכניסיתי לכתוב במנותק מהתוכנה, הייתי צריך לשכתב הכל בהרצה הראשונה). מצד שני, מעולם לא פגשתי בודק תוכנה שלא כתב את תוכנית הבדיקות תוך כדי אלתור. נכון, חלק מאיתנו מאלתרים ממש נהדר עם כלים מרשימים כמו מחלקות שקילות, בדיקות קומבינטוריות, פרסונות או מקרי-שימוש (use cases, בלע"ז), אבל בסופו של יום, הבודק שכותב את תוכנית הבדיקות הוא זה שבוחר באיזה כלי להשתמש ואילו נתונים מוזנים לתוך כל אותם כלים (כמובן, אני לא טוען שהכלים האלה חסרי תועלת - להיפך, יש בהם תועלת רבה - אבל בסופו של יום, הבודק המיומן ידע מתי נכון להשתמש באיזה כלי ומתי לא). 

אני רוצה להציג את השאלה הבאה: כיצד יראו התוצאות של בדיקות חוקרות של מסמך דרישות?
קחו רגע לחשוב על זה. 
...
...
...
...

חשבתם? מצויין. כל מי שענה "בדיקות חוקרות אפשר לעשות רק על תוכנה קיימת שאפשר להפעיל ולחקור", שילך להתבייש בפינה. כל היתר - מצויין. 
התשובה שלי לזה היא "זה נראה כמו תוכנית בדיקות". כשאני בודק מסמך (ולאלה שמחבבים את המינוח שמשמש את ISTQB, תזכורת - סקירה של מסמך היא חלק ממה שאנחנו מכנים בשם "בדיקות סטטיות"), אני מייצר מודל של איך התוכנה אמורה לפעול, אני אוסף שאלות שמצביעות על פערים במודל, או על חוסר עקביות בדרישות. אני מחפש סיכונים שאולי נרצה להתייחס אליהם ולהציב כמה מנגנוני הגנה כדי להקטין את הנזק מהם (ולפעמים מנגנון ההגנה הזה הוא "נבדוק את התוכנה כשתהיה מוכנה ונחפש תקלות מסוג מסויים ברכיב הזה), ואז אני מוסיף את הידע שאספתי בחזרה לצוות כדי שנוכל להתייחס אליו. בקיצור, איך שלא מסתכלים על זה, ביצעתי כאן "בדיקות". אם נשים לב שבמהלך התהליך הזה גם למדתי על המוצר והתאמתי את המודלים שלי אליו תוך כדי שההבנה שלי גדלה, אני חושב שאנחנו מכסים גם את החלק של "חוקרות" (ואם לא, אפשר לצטט אנשים אמיתיים ולא להעמיד פנים שיש "גורו"ים אלמוניים, כי אני מסכים למדי עם ההגדרה של באך ובולטון לפיה "כל הבדיקות הן בדיקות חוקרות" ). 

בקיצור, אם אנחנו מקבלים את זה שכתיבת תוכנית בדיקות היא ביצוע בדיקות חוקרות, איך אפשר לבסס את הטענה שביצוע של הבדיקות האלה הוא סוג אחר של בדיקות? ולמה להתעקש על הפרדה של תכנון הבדיקות וביצוען בפועל? בטח, יש מקרים בהם עדיף לנו לכתוב כל מיני דברים מראש - אם יש דברים שחשוב לנו לא לשכוח, או אם אנחנו רוצים להתמודד עם מגוון רחב של הטיות שיש לנו תוך כדי התעסקות בתוכנה - אבל יש גם מקרים בהם כתיבה מראש היא בזבוז זמן ותו לא. ההסתמכות על מיומנותם של בודקי התוכנה מאפשרת לנו את החירות לבחור במה שנכון עבור המצב בו אנחנו נמצאים, ולכן אני מעדיף שלא להשתמש במונחים שמסיטים את תשומת הלב מהעובדה החשובה הזו.  

Monday, June 12, 2017

Nordic testing days - closing it all up


So, second day of NTD 2017... The scary part where I get to speak. At least, it was directly after the keynote, so I would have most of my day worry-free. 
Fiona Charles's keynote raised an important matter - As testers we should be responsible for our ethics - both towards the company that hires us, but more importantly, to the public that our product affect, and to ourselves. In a perfect world, everyone would be doing the right thing, so there will be no ethical dilemmas. Sadly, our world is not perfect, and we are asked to lie, or help in covering up information, or take part in a product that we think is morally inappropriate (my personal "no way I'll work there" include gambling sites, porn and most ad-services). In such cases, we have to know when to say "no". "No" to lying. "No" to deception. Also, it is very important to know that there are levels of saying that no. Most of the times, this no should be voiced internally - Letting the product owner know that the tests indicate a very high risk in releasing the software, asking again if we are comfortable with *this* business decision, going over your manager's head to make sure your concerns are not ignored irresponsibly, even resigning when you think the company is acting immorally (but not illegally) . Sometimes, when there's something more serious is on the line, it means that we should notify external entities - turn the external auditor's attention to the flaw that might cause a safety-critical component to malfunction, anonymously tipping the police when acts of fraud are being sanctioned by the CEO,  or even going to the media to reveal how irresponsibly the company is handling their user data despite all warnings and attempts to fix this. 
My main takeaway from this talk is that it's always easy to know what is the right thing for others to do. Especially in retrospect. Knowing the right thing to do yourself, and having the courage to do so - is not always that simple. Let's hope we won't face such dilemmas ourselves. 

Then, after the break, there was my talk. Was I nervous? yes. I think it went well, and some of the questions I got at the end indicated that my message had indeed reached at least some of the audience (my message, in short - threat modeling is very much like testing, so go and do that. 

After that, I could enjoy the rest of the conference worry-free, and went on to listen to some very good talks (such as Carly Dyson's talk on her insights from being a consultant, Melissa Marshall's thoughts about integration tests or Gwen Diagram's talk on logging and monitoring). 

Finally, was the closing keynote. Usually, I really like the keynotes - where you get great speakers with ideas that are inspiring and thought provoking. This one, sadly, was neither. The speaker, Kristjan Korjus, showed us a really interesting product - a robot that is meant to facilitate "last mile delivery" and make delivery a lot less expensive. It is, to borrow the Cynefin terminology, a very complex situation, and thus probably the most interesting situation, when the way forward is by probing fast and learning in retrospect, so I'm assuming that any of the directions there could have made out a great keynote that will give people something to take home except "oh, look, a cute robot". Instead, we got something that looked a lot like a sales pitch, and I'm not even sure who is supposed to buy what. 

Anyway, after the keynote and thanking the amazing conference team for their magnificent work we've moved to a nice bar for the after-party, where we got to say goodbye to those flying soon after the conference ends, and chat a bit more over dinner with those that were staying another night.
Yes, naturally we met a bit more with people at a(nother) pub for some more chats and fun. 

The last day where I could say it was still a bit conference-y was when we met the next morning for breakfast and final goodbyes. I then went with Sven for a day-trip in the countryside (where I took the picture you can see above). A really nice way to take a slow cooldown from a conference. 

So, all in all - it was a great conference. A lot to consider, great experiences and even greater people. If you are making a list of conferences you want to attend, this one should be very high on your list. 

Friday, June 9, 2017

Nordic testing days - day 1

So, the tutorials day is over, and the first day of talks began.
For starters, it was a lot more crowded. With ~500 attendees, it's the largest testing conference I attended, and the atmosphere is absolutely electrifying. A lot of things to learn and experience, and a whole lot of new people to meet.
With so much going on, I could probably babble about the experiences I had for quite a while, but instead I want to pinpoint some of the highlights of the day.
First to be mentioned is Franziska Sauerwein's workshop on refactoring JUnit tests. I'm quite comfortable with Java, so I came with the expectation of learning new coding habits by watching other people's (in this case - Franzi's) way of coding. And indeed, that is mostly what I got. The workshop went pretty well, at least as far as I can determine, and I got out with several pointers on how to improve some of the code I am writing (also, need to check Hamcrest, with which I was not familiar before). A workshop that makes a very clear promise, and then delivers it exactly.
Similarly, Kevin Harris's talk about losing third of the testers and surviving that. When a crisis happens, you must adapt, and Kevin shared with us some of the extreme measures they had to take to cope with this change. Some of them, probably, are better off when done with the luxury of time at hand - and even if they don't, they sure seem like the right thing to do (others, on the other hand, are crisis-only action, so I hope not to ever need them, but I'm stacking them in memory just in case).
The final keynote of the day was given by Alan Richardson, and was all about taking control of the way each of us treats testing. It was not a new message, but it sure was very inspiring and super important for new testers, while remaining not less important reminder to the rest.
And so, the day was concluded.
Or was it?
A conference dinner shortly followed, and then some sort of a party - with disco-lights and drummers. I took the chance to get some 20 minutes of quiet time before returning for the lightning talks and the Powerpoint karaoke - both of were real fun. I especially liked Gwen Diagram's lightning talk which was a very fast-paced,foul-mouthed ode to rapid development named "me and Mr. T".

A long day, and quite a fun one at that. Now, for the final day of the conference, where I'll be presenting my talk.
How did the Romans say? Ave, Imperator, morituri te salutant.

Thursday, June 8, 2017

Nordic testing days - tutorials day


Today was the tutorials day at NTD, and what a lovely start for a conference it was.
Choosing a tutorial was really difficult (so I'm glad I've done that part when registering) - with the exception of "java for testers" that claims to cover stuff I already know, I simply couldn't tell which one I prefer going to. By the end, I chose Fiona Charles's workshop on heuristics. It started out really well, with a short overview of what heuristics are - and I do prefer her way of looking at it as "shortcuts" instead of the overly wide "fallible methods of solving a problem", since it narrows the field at least a bit. My main difficulty with "heuristics" is that it can be used to describe just about anything people do, and using "shortcuts" narrows the field of discussion to useful heuristics and enables some sort of a meaningful discussion about it.
Before lunch, we played some children games, and tasked with the goal of finding some heuristics to solve the puzzles and track our heuristics as they changed over the exercise. What really got me was that none of the initial heuristics we tried to apply first held true, and soon after starting to actually solve the puzzle. Doing something only because it seemed to make sense in the past is not necessarily a good idea. The cool thing in this, though, is that heuristics that are not helpful were als really hard to follow for a longer period of time.
The second part of the workshop started by watching this video and being asked "what heuristics would be useful for testing this, if all the information that you have is this video?" Well, that was tougher than I thought it should be. Armed with the (tacit) knowledge that coming up with heuristics before actually doing some of the work would not necessarily be productive, we got to the task of coming up with test ideas and filling the information gaps we had with assumptions. After doing that for a while, we've tried grouping the test ideas to similar categories in hope of distilling it to a point where it would be easier to notice some of the heuristics we were using - that didn't go as well as I thought it would, since we found ourselves looking at a checklist (which is a great heuristic by itself), and not really knowing what was leading us. In the latest 3 minutes or so of the exercise something clicked and we were able to detach ourselves enough from test-idea generation, and look at how we were doing that. Our main heuristic to generate ideas was using scenarios (or use-cases, if you would prefer), which had a lot to with personas (the phrase "redneck with a crowbar" did come up once or twice). I could totally see how naming those heuristics could help me get a better coverage given some more time, but as it usually is in workshops - time is of the essence.

The day ended with speaker's dinner, which started in the cute train you can see at the top. quite a nice way to get to where we wanted - it started with a toast on some sort of a balcony, overseeing the beautiful Tallinn, followed by a medieval-themed dinner (in a dark, candle-lit restaurant), after which we were dragged to a bar to try out something called millimalikas (or something of the sort, I heard it means "jellyfish" is Estonian, but did not verify that), which is two sorts of alcohol, one of which is anise-based (read: really disgusting) and some tabasco to make it painful. Thankfully, the tabasco  burn did eradicate the anise after-taste, but it is definitely not something I would repeat.
All in all, a packed day, which was a prequel to an even more packed conference.