我正在建立持续集成。我决定实施从运行中排除测试的机会。我看到了3种方法:
请您分享您的经验,并说明如何应用真正的决定。谢谢!
答案 0 :(得分:0)
我不建议在测试源中使用注释。假设您的测试受版本控制,每当您更改此类配置设置时,它们都不应更改。
在不了解您的构建系统的情况下很难给出好的建议,但如果您的QA系统有类似全局“环境配置”的东西,我建议将其放在那里。如果您能够指定要在trac票证中运行的测试,然后自动运行那些非常棒的正确测试 - 我从未尝试过,所以不知道这是否可行。
答案 1 :(得分:-1)
我决定分享结果。我很乐意听到任何意见
#!/bin/sh
USER=...
PASSWD=...
TRAC_URL=https://...
# keywords which indicates block with list of excludable tests
START_KW=excl
END_KW=endexcl
function get_active_tickets_numbers {
# wget page with active tickets
# cut number from paths like '/ticket/161', which is found in '<a title=View ticket href=/ticket/161>'
local user=$USER
local passwd=$PASSWD
# set max to big value or else there will be several pages
local active_tickets_url=$TRAC_URL/report/2?max=1000
# uniq : link to the same ticket repeats in columns 'Ticket' and 'Summary' so delete repeats
wget \
--no-check-certificate --http-user=$user --http-password=$passwd -O \
- $active_tickets_url \
| perl -ne '/ticket\/(\d+)/; print "$1 "' \
| uniq
}
function get_excl_list_of_ticket {
# wget ticket page
# cut blocks between $start_kw (keyword) and $end_kw that must be located in decription section
# remove html tags
# cut pathes by the rule: all allowable chars starting at the end of word
local ticket_num=$1
local user=$USER
local passwd=$PASSWD
local ticket_url=$TRAC_URL/ticket/$ticket_num
local start_kw=$START_KW
local end_kw=$END_KW
local legal_char='[a-zA-Z0-9\/_\-.]'
wget \
--no-check-certificate --http-user=$user --http-password=$passwd -O \
- $ticket_url \
| perl -e \
'undef $/;
$_ = <>;
while ( /'$start_kw'(.*?)'$end_kw'/sg ) {
$block = $1;
$block =~ s/<.*?>//sg;
while ( $block =~ /('$legal_char'+)[ \n\t]/g ) {
print "$1\n";
}
}'
}
function get_excl_list_1 {
nums=`get_active_tickets_numbers`
for num in ${nums[@]}; do
get_excl_list_of_ticket $num
done
}
function get_excl_list {
get_excl_list_1 | uniq
}
get_excl_list