项目背景:为了配合二级交易平台做媒体保护, 需要将媒体保护功迁移到按照setting-list 进行过滤保护
功能测试设计:(只列一种情况)
准入功能/LU-dsp对流量过滤功能测试 | Check点: herry id与kate id映射关系读取是否正确; 针对流量的行业过滤功能是否正确,请求的publisher_settings_list_id在publisher_settings_list.dat文件中 |
1 | 1. 在publisher_settings_list.dat文件中添加一行过滤规则: 494\t{"advertiser": null,"keyword": null,"price": null,"vulgar": null,"dsp": null,"creativeType": null,"oldIn dustry": [3, 4, 2101],"industry": [5501, 6901, 5301, 53]} 2. 配置herry2kate.txt文件,添加herry_id到kate_id的映射规则: 3\t234 4\t333 2101\t234 3.配置kate字典,设置词与对应的kateid: 1st1st1st对应的kateid为234; 2nd2nd2nd对应的kateid为99999 4. 设置wordid词典: simplify_kt_dict.txt 1111\t1st1st1st 2222\t2nd2nd2nd 5. 设置行业黑名单词典与热词词典为空 6. 设置lu-as的请求中的publisher_settings_list_id为494,seller_network_id=8 7. 设置ui2as的请求特征词wordid为:1111与2222 |
(1) Herryid与kateid行业映射正确,1st1st1st词被过滤,as返回2nd2nd2nd {"qpres_log":"luw:2nd2nd2nd","keywords":[{"lu_word":"2nd2nd2nd"}]} |
具体case(只列一个)
# -*- coding: GB18030 -*- from LuasBaseCase import * from Caseimport import * class luas_publisher_filter_case_1(LuasBaseCase): def preEnv(self): ''' owner: qixuan02 测试步骤: 1.设置publisher_settings_list.dat文件,设置一行过滤规则-----只进行行业过滤 2.配置herry2kate.txt文件,使其包含herryid2kateid的映射关系 3.配置kate词典,设置kateid与keyword的映射 4.设置wordid与keyword的映射,特征词进行反签得到keyword 5.设置行业黑名单与热词词典为空 6.设置特征词wordid 7.设置luui2as请求中的publisher_settings_list_id,配置seller_network_id=8表示流量, 8.验证针对流量行业过滤生效 ''' #set publisher_settings_list super(self.__class__,self).preEnv() FileFactory_obj = FileFactory() publisher_settings_list_fname_obj = FileFactory_obj.getFileInstance('publisher_settings_list_path/publisher_settings_list_fname') publisher_settings_list_fname_obj.addRawData('494\t{"advertiser": null,"keyword": null,"price": null,"vulgar": null,"dsp": null,"creativeType": null,"oldIndustry": [3, 4, 2101],"industry": [5501, 6901, 5301, 53]}') publisher_settings_list_fname_obj.write() #set herry2kate dict lu_herry2kate_fname_obj = FileFactory_obj.getFileInstance('lu_herry2kate_dir/lu_herry2kate_fname') lu_herry2kate_fname_obj.addRawData('3\t34') lu_herry2kate_fname_obj.addRawData('4\t333') lu_herry2kate_fname_obj.addRawData('2101\t34') lu_herry2kate_fname_obj.write() #set wordid dict kt_dict_conf_fname_obj = FileFactory_obj.getFileInstance('kt_dict_conf_dir/kt_dict_conf_fname') kt_dict_conf_fname_obj.addRawData('1111\t1st1st1st') kt_dict_conf_fname_obj.addRawData('2222\t2nd2nd2nd') kt_dict_conf_fname_obj.write() #set kateid_to_fc_tradeid dict to empty kt2fc_dict_conf_fname_obj = FileFactory_obj.getFileInstance('kateid_to_fc_tradeid_dir/kateid_to_fc_tradeid_fname',version="0") kt2fc_dict_conf_fname_obj.write() #set kate black list to empty kt_dict_conf_fname_obj = FileFactory_obj.getFileInstance('kate_black_list_dir/kate_black_list_fname',version="0") kt_dict_conf_fname_obj.write() #set hot term dict to empty hot_term_dir_hot_term_fname_0_obj = FileFactory_obj.getFileInstance('hot_term_dir/hot_term_fname',version='0') hot_term_dir_hot_term_fname_0_obj.write() hot_term_dir_hot_term_fname_1_obj = FileFactory_obj.getFileInstance('hot_term_dir/hot_term_fname',version='1') hot_term_dir_hot_term_fname_1_obj.write() #set kate dict one_req_0 = g_caseGlobal.luasDriver.addReq() self.luas_katelib=one_req_0.addKateLib() kate_text = KateText("1st1st1st") kate_text.add_KateItem(KateItem(id="34",score=2.3,prob=3.3,label=2)) self.luas_katelib.addKateText(kate_text) kate_text = KateText("2nd2nd2nd") kate_text.add_KateItem(KateItem(id="99999",score=2.3,prob=3.3,label=2)) self.luas_katelib.addKateText(kate_text) #set LUUI request luas_request_0 = one_req_0.addLuas_query() luas_request_0.__protobuf_obj__.req_keyword_num[0]=2 luas_request_0.__protobuf_obj__.publisher_settings_list_id.append(494) luas_request_0.__protobuf_obj__.seller_network_id = 8 #set dmp server response QT,word_id=0 #设置lu-ui请求lu-as传过来的xfs特征词 query_word_0=luas_request_0.__protobuf_obj__.query_word.add() query_word_0.word_id=1111 query_word_0.weight = 10 query_word_0.basic_weight = 10 query_word_0.sign = 421524911880790740 query_word_1=luas_request_0.__protobuf_obj__.query_word.add() query_word_1.word_id=2222 query_word_1.weight = 20 query_word_1.basic_weight = 20 query_word_1.sign = 403240651640081344 #dump to file, g_caseGlobal.luasDriver.write() #检查测试结果是否符合预期 #luas 返回给luui 的response def check(self): self.addAssert(0,'{"qpres_log":"2nd2nd2nd","keywords":[{"lu_word":"2nd2nd2nd"}]}')