This topic has been archived. It cannot be replied.
-
工作学习 / 事业工作 / 我面试时候被问到的一道QA面试题,请大家抢答:如果有一段程序有五个if then,那应该写多少个test cases?这个问题倒是我第一次被问。我当时答10个。面试完以后我回头问我老公,他说是n个。想想也是。是不是如何摆放这if then都是六个? 刚才画了一画草图,还真是不管如何组合都是这n个。刚问他的时候,他也楞了一下,说了一个数字,画了图以后纠正了前面的数字。
-tracyd(等待明天);
2021-10-26
{238}
(#14068468@0)
-
Minimal 6. Maximal 2 powers 5 = 32.
-sailor(Ocean & Mountain);
2021-10-26
(#14068481@0)
+1
-
你的回答是对的啊,JUNIT覆盖10个branch就可以了。
-ff2021(ff2021);
2021-10-26
(#14068509@0)
-
no max
if (a>6 or b>0 and c<2 and not d !=4){
}
else{
}
只有一个if你写几个?
-sxffff(lookingforjob);
2021-10-26
{117}
(#14068513@0)
+2
-
如果没有or 和and的条件if语句呢?五个是多少test cases?
-tracyd(等待明天);
2021-10-26
(#14068528@0)
-
boolean 可以提前计算,没有 OR /AND 的if语句没有区别。
-sxffff(lookingforjob);
2021-10-26
(#14068620@0)
-
条件太复杂,应该摘出来单独测试比较好,单元不宜太复杂。
-ff2021(ff2021);
2021-10-26
(#14068897@0)
-
你的意思是要改程序?大部分的code都不是unit testable,API 定下来了不能改,只测public API, private function 是black box,复杂度无法知道。
-sxffff(lookingforjob);
2021-10-27
(#14071300@0)
-
2的5次方个
-xiangcaosh(船头);
2021-10-26
(#14068560@0)
+2
-
你首先应该反问,用什么test strategy, 如果是black box test strategy, 并不关心有多少if then, 取决于business input。如果是white box, 根据不同的strategy, 结果不同,比如,如果用path,那么最少需要M个test cases M = E – N + 2P,自己画个map, 算一下
E = number of edges
N = number of nodes
P = number of connected components
-keysi(K.S);
2021-10-26
{93}
(#14068570@0)
+1
-
这是一个dev team里的测试职位,需要进行unit test. 测这种东西,还轮不到business input呢。
-tracyd(等待明天);
2021-10-26
(#14068599@0)
-
unit test不都是程序员自己搞,还有专门做unit test的?
-keysi(K.S);
2021-10-26
(#14068602@0)
+2
-
那是homedepot的一个DEV部门要招一个QA测API,直接和DEV们一起工作。很多时候DEV给的东西没好好测,或者intergration测试没做好,给到QA大量feature无法工作,浪费很多时间。所以需要一个内部的QA先过一遍,然后再给QA team测。
-tracyd(等待明天);
2021-10-26
(#14068713@0)
-
哈,homedepot,我记得去年很长一阵他家网站翻页一直不work,要手动改url才行
-guestagain(guest again);
2021-10-26
(#14068739@0)
+1
-
听中介说他们很为他们的ecommerce的网站骄傲的。毕竟covid以后大量购物都需要在网上购买。那职位给的rate不高,要求还挺高的。不过他们面试我以后,push了我去学习更多postman的知识。我把youtube上postman的不少视频都看了,还自己做了练习。然后学习如何传变量到下一个步骤,以前只是copy paste那些数据。
还去把postman的snippet全部都去仔细过了一遍,还有去学它的javascript,包括部分assertion chai js.
-tracyd(等待明天);
2021-10-26
{278}
(#14068771@0)
-
Homedepot啊,我在LAB的时候当过他们的咨询顾问,ibm的那个commerce
-keysi(K.S);
2021-10-26
(#14068782@0)
-
还有过一次homedepot的另外一个QA职位,跑上来直接在某一个写code测试的网站写selenium code,什么debug的环境都没有,和在notepad里写没任何区别的。写个java code还有环境,但那个网上测试网站没selenium的。估计很多coding测试网站都没有。
-tracyd(等待明天);
2021-10-26
(#14068821@0)
-
那个bug怎么说呢?初级到这个地步:第一页是 ...&p=1, 然后点第N页,就变成了 ...&p=1&p=N,我当时真的是无语了……
-guestagain(guest again);
2021-10-26
(#14068831@0)
-
我不知道有这事,几乎从来不去他们家网站。估计中介也不知道,就算知道了,也不会去挑战hiring manager.估计都把测试给自动化了,所以才有这种低级错误。
-tracyd(等待明天);
2021-10-26
(#14068902@0)
-
我个人的看法,程序员太烂了,写完都不自己哪怕简单的测试一下的?这种东西能过的了写程序的自己这一关?现在的世界太神奇了……
-guestagain(guest again);
2021-10-26
(#14068911@0)
-
前说过那是一个api的测试职位。需要在gui做出来前做一些测试。
-tracyd(等待明天);
2021-10-26
(#14068929@0)
-
我这个纯粹自己感慨一下,和你说的职位啥的无关。
-guestagain(guest again);
2021-10-26
(#14069039@0)
-
偷懒,写完了就一扔了事。
-tracyd(等待明天);
2021-10-26
(#14069189@0)
-
现在很多的程序在developer的local machine都跑不了, 只能先checkin,然后让QA测,测不出来谁也没办法。
-sxffff(lookingforjob);
2021-10-27
(#14071308@0)
-
码工自己不测就交给QA我是见怪不怪,他们只测最基本的功能,我觉得神奇的是QA都没发现
-greenfield_2011(greenfield);
2021-10-27
(#14069675@0)
-
码工都被QA惯坏了…… 现在的所谓code review也一样,大部分PR真的有人看?
-guestagain(guest again);
2021-10-27
(#14069930@0)
-
应该是6个吧, 如果没记错。test case 的设计原则是最少的case, 最大的coverage. 有个efficient要求在里面。
-fourseasonscan(有话直说);
2021-10-27
(#14069285@0)
-
我老公也说是6个。不过面试官没给我答案,所以我上来求验证。结果也是各种答案都有,晕。估计给QA回答,答案会更离奇。
-tracyd(等待明天);
2021-10-27
(#14070828@0)
+1
-
我记得测decisions 的test cases 数是有公式的。应该是n+1.
-fourseasonscan(有话直说);
2021-10-27
(#14071320@0)
-
就我没看懂吗?你的答案里N是多少?我自己答案是2的五次方如果需要100% code coverage. 但也要看requirement,如果有些path 是requirement没有的,就不用测
-greenfield_2011(greenfield);
2021-10-27
(#14069711@0)
+1
-
N就是若干个,是我暂时不想说,我说了还会有人给答案么?btw, 前面说了,不看requirement。就测逻辑和路径。要把每一个路径都走一遍。一个路径一个testcase. 我前面没说么?
-tracyd(等待明天);
2021-10-27
(#14070831@0)
-
没仔细看前面。我就是回答你的问题。
-greenfield_2011(greenfield);
2021-10-28
(#14072884@0)
-
Multiple condition coverage (MCC) vs Modified Condition/Decision Coverage (MC/DC). MCC 需要 2^N。MC/DC 需要 N + 1。
-xmlhttprequest(build5381);
2021-10-27
(#14071227@0)
-
多谢,有空我去查查你说的MCC和MCD.
-tracyd(等待明天);
2021-10-28
(#14072044@0)
-
fyi - 我给了个 link
-xmlhttprequest(build5381);
2021-10-28
(#14072291@0)
-
多谢,我看到链接了,但没深刻理解。还得查查。
-tracyd(等待明天);
2021-10-28
(#14072513@0)
-
这个问题其实还蛮不错的 -- dev 在写一个 function 的时候,需要考虑这个 function 需要多少个 unit tests,如果太多,可能需要考虑一定的重构,降低 / 分离 dependencies。
-xmlhttprequest(build5381);
2021-10-28
(#14073081@0)