如题,Acts测试项ActsRequestStageTest和ActsRequestETSApiTest在仅存在有线网络的设备情况下测试失败, Acts相关项不支持有线网络吗?大家有没有遇到过类似情况,发动社区的力量帮忙确认下。

测试失败项如下表所示:

img

其中acts测试项SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001代码如下:

/**
     * @tc.number SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001
     * @tc.desc Get mimetype of the download task
     * @tc.size      : MEDIUM
     * @tc.type      : Function
     * @tc.level     : Level 2
     */
    it('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001', 0, async function (done) {
      console.info("====>---------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 is starting---------------------");
      let downloadFilePath = `${globalThis.abilityContext.tempDir}/SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001.txt`
      console.debug("====>downloadFileConfig:" + `${globalThis.abilityContext.tempDir}/SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001.txt`)
      let downloadFileConfig = {
        url: 'https://gitee.com/chenzhixue/downloadTest/releases/download/v1.0/test.apk',
        header: {
          headers: 'http'
        },
        enableMetered: false,
        enableRoaming: false,
        description: 'XTS download test!',
        networkType: request.NETWORK_WIFI,
        filePath: downloadFilePath,
        title: 'XTS download test!',
        background: false
      }
      let flag = false;
      request.downloadFile(globalThis.abilityContext, downloadFileConfig, async (err, downloadTask) => {
        console.info("====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 downloadTask: " + downloadTask);
        try{
          expect(downloadTask != undefined).assertEqual(true);
          downloadTask.on('progress', async (data1, data2) => {
            try{
              if (data1 > 0 && flag == false){
                flag = true;
                downloadTask.off('progress');
                downloadTask.getTaskMimeType(async (err, data)=>{
                  try{
                    if(err) {
                      console.error('====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 err:'+ JSON.stringify(err));
                      fileio.unlinkSync(downloadFilePath);
                      expect().assertFail();
                      done();
                    }
                    if (data) {
                      console.info('====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 data:' + JSON.stringify(data));
                      expect(typeof data == "string").assertTrue();
                    } else {
                      console.error("====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 error: " + JSON.stringify(err));
                      expect().assertFail();
                    }
                  }catch(err){
                    console.error("====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 throw_error: " + JSON.stringify(err));
                  }
                  let t = setTimeout(async ()=>{
                    await downloadTask.delete();
                    fileio.unlinkSync(downloadFilePath);
                    clearTimeout(t);
                    done();
                  },1000)
                });
              }
            }catch(err){
              console.error("====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 error: " + JSON.stringify(err));
              await downloadTask.delete();
              fileio.unlinkSync(downloadFilePath);
              done();
            }
          })
        }catch(err){
          console.error("====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 error: " + JSON.stringify(err));
          await downloadTask.delete();
          fileio.unlinkSync(downloadFilePath);
          done();
        }
      })
    });

自行写个Sample验证其中SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001测试项,日志如下:

10-09 09:16:33.643  2340  2340 D C01c00/Downloadkit: [application_state_observer.cpp OnAbilityStateChanged 77] OnAbilityStateChanged uid=20010038,  bundleName=com.sample.request,state=2
10-09 09:16:33.643  2340  2340 I C01c00/Downloadkit: [download_service_manager.cpp UpdateAppState 468] UpdateAppState uid=20010038, bundleName=com.sample.request, state=2
10-09 09:16:33.661  2340  2340 D C01c00/Downloadkit: [application_state_observer.cpp OnAbilityStateChanged 77] OnAbilityStateChanged uid=20010038,  bundleName=com.sample.request,state=2
10-09 09:16:33.661  2340  2340 I C01c00/Downloadkit: [download_service_manager.cpp UpdateAppState 468] UpdateAppState uid=20010038, bundleName=com.sample.request, state=2
10-09 09:16:37.843  3641  3641 D C01c00/Downloadkit: [download_task_napi_V9.cpp JsMain 57] Enter download JsMain.
10-09 09:16:37.843  3641  3641 E C01c00/Downloadkit: [download_manager.cpp LoadDownloadServer 213] service already exists
10-09 09:16:37.844  3641  3641 D C01c00/Downloadkit: [download_service_proxy.cpp CheckPermission 289] DownloadServiceProxy::CheckPermission in
10-09 09:16:37.844  2340  2366 E C01c00/Downloadkit: [download_service_stub.cpp OnRemoteRequest 37] request code = 8
10-09 09:16:37.844  2340  2366 D C01c00/Downloadkit: [download_service_stub.cpp OnCheckPermission 257] DownloadServiceStub::OnCheckPermission in
10-09 09:16:37.844  2340  2366 D C01c00/Downloadkit: [download_service_stub.cpp OnCheckPermission 263] DownloadServiceStub::OnCheckPermission out
10-09 09:16:37.844  3641  3641 D C01c00/Downloadkit: [download_service_proxy.cpp CheckPermission 304] DownloadServiceProxy::CheckPermission out [ret: 1]
10-09 09:16:37.844  3641  3641 D C01c00/Downloadkit: [download_task_napi_V9.cpp operator() 76] download parser to native params 2!
10-09 09:16:37.844  3641  3641 D C01c00/Downloadkit: [download_task_napi_V9.cpp Initialize 141] constructor download task!
10-09 09:16:37.844  3641  3641 E C01c00/Downloadkit: [download_task_napi_V9.cpp GetContext 213] GetContext. L8
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_task_napi_V9.cpp ParseHeader 268] current name list size = 1
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_manager.cpp EnqueueTask 56] DownloadManager EnqueueTask start.
10-09 09:16:37.845  3641  3641 E C01c00/Downloadkit: [download_service_proxy.cpp Request 60] fd: -1 start
10-09 09:16:37.845  3641  3641 E C01c00/Downloadkit: [download_service_proxy.cpp Request 76] fd: 50 end
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 157] fd: -1
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 158] fd errno: 0
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 159] URL: https://gitee.com/chenzhixue/downloadTest/releases/download/v1.0/test.apk
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 160] enableMetered: false
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 161] enableRoaming: false
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 162] description: XTS download test!
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 169] networkType: WLAN
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 170] filePath: /data/storage/el2/base/haps/entry/temp/SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001.txt
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 171] title: XTS download test!
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 173] Header Information:
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp operator() 175] X-Cipher-List : TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,TLS_DSS_RSA_WITH_AES_256_GCM_SHA384,TLS_PSK_WITH_AES_256_GCM_SHA384,TLS_DHE_PSK_WITH_AES_128_GCM_SHA256,TLS_DHE_PSK_WITH_AES_256_GCM_SHA384,TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256,TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384,TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_CCM,TLS_DHE_RSA_WITH_AES_256_CCM,TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_PSK_WITH_AES_256_CCM,TLS_DHE_PSK_WITH_AES_128_CCM,TLS_DHE_PSK_WITH_AES_256_CCM,TLS_ECDHE_ECDSA_WITH_AES_128_CCM,TLS_ECDHE_ECDSA_WITH_AES_256_CCM,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_AES_128_GCM_SHA256,TLS_
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp operator() 175] headers : http
10-09 09:16:41  3641 D C01c00/Downloadkit: [download_config.cpp Dump 177] Header Information -------------- End
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 179] bundleName: com.sample.request
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 180] background: false
10-09 09:16:37.845  3641  3641 D C01c00/Downloadkit: [download_config.cpp Dump 181] uid: 20010038
10-09 09:16:37.845  2340  2366 E C01c00/Downloadkit: [download_service_stub.cpp OnRemoteRequest 37] request code = 0
10-09 09:16:37.845  2340  2366 D C01c00/Downloadkit: [download_service_stub.cpp OnRequest 75] Receive request
10-09 09:16:37.845  2340  2366 I C01c00/Downloadkit: [download_service_stub.cpp OnRequest 78] Get FD from client, fd [13]
10-09 09:16:37.845  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 157] fd: 13
10-09 09:16:37.845  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 158] fd errno: 2
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 159] URL: https://gitee.com/chenzhixue/downloadTest/releases/download/v1.0/test.apk
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 160] enableMetered: false
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 161] enableRoaming: false
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 162] description: XTS download test!
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 169] networkType: WLAN
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 170] filePath: /data/storage/el2/base/haps/entry/temp/SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001.txt
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 171] title: XTS download test!
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 173] Header Information:
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp operator() 175] X-Cipher-List : TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,TLS_DSS_RSA_WITH_AES_256_GCM_SHA384,TLS_PSK_WITH_AES_256_GCM_SHA384,TLS_DHE_PSK_WITH_AES_128_GCM_SHA256,TLS_DHE_PSK_WITH_AES_256_GCM_SHA384,TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256,TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384,TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_CCM,TLS_DHE_RSA_WITH_AES_256_CCM,TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_PSK_WITH_AES_256_CCM,TLS_DHE_PSK_WITH_AES_128_CCM,TLS_DHE_PSK_WITH_AES_256_CCM,TLS_ECDHE_ECDSA_WITH_AES_128_CCM,TLS_ECDHE_ECDSA_WITH_AES_256_CCM,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_AES_128_GCM_SHA256,TLS_
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp operator() 175] headers : http
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 177] Header Information -------------- End
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 179] bundleName: com.sample.request
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 180] background: false
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_config.cpp Dump 181] uid: 20010038
10-09 09:16:37.846  2340  2366 D C01c00/Downloadkit: [download_service_manager.cpp MoveTaskToQueue 317] Status [5], Code [8], Reason [4]
10-09 09:16:37.846  2340  2366 I C01c00/Downloadkit: [download_service_ability.cpp Request 182] DownloadServiceAbility Allocate Task[13] started.
10-09 09:16:37.846  3641  3641 D C01c00/Downloadkit: [download_manager.cpp EnqueueTask 68] DownloadManager EnqueueTask succeeded.
10-09 09:16:37.846  3641  3641 D C01c00/Downloadkit: [download_task_napi_V9.cpp Initialize 191] Succeed to allocate download task
10-09 09:16:37.846  3641  3641 E C01c00/Downloadkit: [async_call.cpp AsyncCall 46] input result:0
10-09 09:16:37.846  3641  3641 D C01c00/Downloadkit: [async_call.cpp Call 64] async call exec
10-09 09:16:37.846  3641  3641 D C01c00/Downloadkit: [async_call.cpp Call 79] async call exec
10-09 09:16:37.846  3641  3659 D C01c00/Downloadkit: [async_call.cpp OnExecute 104] run the async runnable
10-09 09:16:37.846  3641  3641 D C01c00/Downloadkit: [async_call.cpp OnComplete 111] run the js callback function
10-09 09:16:37.847  3641  3641 D C01c00/Downloadkit: [download_event.cpp On 26] on Enter ---->
10-09 09:16:37.847  3641  3641 D C01c00/Downloadkit: [download_service_proxy.cpp CheckPermission 289] DownloadServiceProxy::CheckPermission in
10-09 09:16:37.847  2340  2366 E C01c00/Downloadkit: [download_service_stub.cpp OnRemoteRequest 37] request code = 8
10-09 09:16:37.847  2340  2366 D C01c00/Downloadkit: [download_service_stub.cpp OnCheckPermission 257] DownloadServiceStub::OnCheckPermission in
10-09 09:16:37.847  2340  2366 D C01c00/Downloadkit: [download_service_stub.cpp OnCheckPermission 263] DownloadServiceStub::OnCheckPermission out
10-09 09:16:37.847  3641  3641 D C01c00/Downloadkit: [download_service_proxy.cpp CheckPermission 304] DownloadServiceProxy::CheckPermission out [ret: 1]
10-09 09:16:37.847  3641  3641 D C01c00/Downloadkit: [download_event.cpp On 49] type : progress
10-09 09:16:37.847  3641  3641 D C01c00/Downloadkit: [download_service_proxy.cpp On 234] DownloadServiceProxy::On type=progress
10-09 09:16:37.847  2340  2366 E C01c00/Downloadkit: [download_service_stub.cpp OnRemoteRequest 37] request code = 6
10-09 09:16:37.847  2340  2366 D C01c00/Downloadkit: [download_service_stub.cpp OnEventOn 210] DownloadServiceStub::OnEventOn taskId = 13 type=progress 
10-09 09:16:37.847  2340  2366 I C01c00/Downloadkit: [download_service_ability.cpp On 249] DownloadServiceAbility::On started. type=progress-13
10-09 09:16:37.847  2340  2366 D C01c00/Downloadkit: [download_service_ability.cpp DoUnregisteredNotify 372] notify combineType: progress-13
10-09 09:16:37.847  2340  2366 I C01c00/Downloadkit: [download_service_ability.cpp Query 206] DownloadServiceAbility Query started.
10-09 09:16:37.847  2340  2366 D C01c00/Downloadkit: [download_service_task.cpp Query 167] Query Task[13], current status is 5
10-09 09:16:37.847  2340  2366 I C01c00/Downloadkit: [download_service_ability.cpp On 267] DownloadServiceAbility::On end.
10-09 09:16:37.847  2340  2366 D C01c00/Downloadkit: [download_service_stub.cpp OnEventOn 233] DownloadServiceStub::OnEventOn out
10-09 09:16:37.847  3641  3641 D C01c00/Downloadkit: [download_service_proxy.cpp On 253] DownloadServiceProxy::On out [result: 1]
10-09 09:16:37.946  2340  2364 I C01c00/Downloadkit: [download_service_task.cpp Run 75] Task[13] start
10-09 09:16:37.947  2340  2364 I C01c00/Downloadkit: [download_service_task.cpp SetStatus 281] Status [1]
10-09 09:16:37.947  2340  2364 D C01c00/Downloadkit: [download_service_task.cpp IsSatisfiedConfiguration 815] isRoaming_: 0, isMetered_: 0, networkType_: 0
10-09 09:16:37.947  2340  2364 D C01c00/Downloadkit: [download_service_task.cpp IsSatisfiedConfiguration 817] config_ { isRoaming_: 0,isMetered_: 0, networkType_: 65536}
10-09 09:16:37.947  2340  2364 I C01c00/Downloadkit: [download_service_task.cpp Run 93] networktype not Satisfied Configuration
10-09 09:16:37.947  2340  2364 I C01c00/Downloadkit: [download_service_task.cpp SetStatus 245] Status [4], Code [10], Reason [4]
10-09 09:16:37.947  2340  2364 D C01c00/Downloadkit: [download_service_ability.cpp NotifyHandler 309] combineType=fail-13 argv1=10argv2=0
10-09 09:16:37.947  2340  2364 D C01c00/Downloadkit: [download_service_ability.cpp AddUnregisteredNotify 359] add combineType fail-13
10-09 09:16:37.947  2340  2364 D C01c00/Downloadkit: [download_service_manager.cpp MoveTaskToQueue 317] Status [4], Code [10], Reason [4]

其中,以下日志值得思考:
10-09 09:16:37.947 2340 2364 I C01c00/Downloadkit: [download_service_task.cpp Run 93] networktype not Satisfied Configuration

更新 ====》》
目前删除WIFI类型测试通过:

img

img

img

img

Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐