Let's say I have a table called Build and a table called Test. Now, for every build there are 3 tests. And the table tests has build_id as foreign key. Also, when a test fails my test framework retries the test again. Given this, there would be atleast 3 entries in the Test table + more based on how many tests failed and how many times it was retries (max = 3). Also, after retries, if the test passes, then the test is marked as passed.
Sample:
Build Table:
Id No of Tests Failure Count
1 3 0
2 3 0
3 3 1
Tests Table:
build_id test_id test_name test_result
1 1 test1 p
1 2 test2 p
1 3 test3 f
1 3 test3 f
1 3 test3 f
1 3 test3 p
2 1 test1 p
2 2 test2 p
2 3 test3 p
3 1 test1 p
3 2 test2 f
3 3 test3 p
2 2 test2 f
2 2 test2 f
2 2 test2 f
Now, based on that I want to print
test_name retries
test3 3
test2 3
If I understand correctly, you want the number of times that a test is "f":
select test_name, count(*) as retries
from tests
where test_result = 'f'
group by test_name;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.