提交 4fab6ed7 编写于 作者: L liangzhenyu123

用例运行优化

Signed-off-by: Nliangzhenyu123 <liangzhenyu6@huawei.com>
上级 205334d0
......@@ -262,7 +262,7 @@ export default function rdbStoreBackupRestoreCallbackTest() {
// RDB restore function test, backup file
RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
if(err != null){
expect(false).assertTrue(0)
expect(false).assertTrue()
}else{
try{
console.info(TAG + 'Backup database success')
......@@ -279,17 +279,18 @@ export default function rdbStoreBackupRestoreCallbackTest() {
}
RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
if(err != null){
expect(false).assertTrue(0)
console.info(`${TAG} Backup database second failed, error: message: ${err.message}`)
expect(true).assertTrue()
done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 end *************")
}else{
try{
console.info(TAG + 'Backup database success')
console.info(TAG + 'Backup database second success')
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){
expect(false).assertTrue();
}
}
done()
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 end *************")
})
})
}
......@@ -333,22 +334,23 @@ export default function rdbStoreBackupRestoreCallbackTest() {
*/
it('RdbBackupRestoreCallbackTest_0700', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 start *************")
RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
let DATABASE_BACKUP_TEST_NAME = "BackupTest.db"
RdbStore.backup(DATABASE_BACKUP_TEST_NAME, (err, data) => {
if(err != null){
expect(false).assertTrue()
}else{
expect(true).assertTrue()
}
})
await dataRdb.deleteRdbStore(context, DATABASE_BACKUP_NAME).then(() => {
await dataRdb.deleteRdbStore(context, DATABASE_BACKUP_TEST_NAME).then(() => {
try{
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_TEST_NAME)
}catch(err){
expect(true).assertTrue();
}
})
RdbStore.restore(DATABASE_BACKUP_NAME, (err, data) => {
RdbStore.restore(DATABASE_BACKUP_TEST_NAME, (err, data) => {
if(err != null){
expect(true).assertTrue()
}
......
......@@ -169,9 +169,13 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
console.info(TAG + "After restore resultSet query done")
resultSet.goToFirstRow();
expect(true).assertEqual(resultSet.goToFirstRow())
console.info("RdbBackupRestoreTest_0010 goto first row success")
const id = resultSet.getLong(resultSet.getColumnIndex("id"))
console.info("RdbBackupRestoreTest_0010 get dolumnindex id success")
const name = resultSet.getString(resultSet.getColumnIndex("name"))
console.info("RdbBackupRestoreTest_0010 get dolumnindex name success")
const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType"))
console.info(`RdbBackupRestoreTest_0010 id is ${id},name id ${name},blobType is ${blobType[0]}`)
expect(1).assertEqual(id)
expect("zhangsan").assertEqual(name)
expect(1).assertEqual(blobType[0])
......@@ -302,24 +306,16 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
*/
it('RdbBackupRestoreTest_0060', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreTest_0060 start *************")
// Backup file is specified to database name
await RdbStore.backup(STORE_CONFIG.name).then(() => {
console.info(TAG + 'Backup database finish')
RdbStore.backup(STORE_CONFIG.name).then(() => {
console.info(TAG + 'Backup database finish');
expect(false).assertTrue() ;
}).catch((err) => {
expect(true).assertTrue()
console.info(TAG + "Backup database error");
expect(true).assertTrue() ;
done();
})
// Backup file is specified to database name again
await RdbStore.backup(STORE_CONFIG.name).then(() => {
console.info(TAG + 'Backup database finish')
}).catch((err) => {
expect(true).assertTrue();
})
done();
console.info(TAG + "************* RdbBackupRestoreTest_0060 end *************")
})
/**
* @tc.name RDB BackupRestore test
* @tc.number SUB_DDM_RDB_JS_RdbBackupRestoreTest_0070
......
......@@ -105,16 +105,20 @@ describe('rdbStoreTest', function () {
let storeConfig = {
name: "/wrong/rdbstore.db",
}
let storePromise = dataRdb.getRdbStore(storeConfig, 4);
storePromise.then(async (ret) => {
console.info(TAG + "getRdbStore done" + ret);
expect(null).assertFail();
}).catch((err) => {
console.info(TAG + "getRdbStore with wrong path");
})
storePromise = null
done();
console.info(TAG + "************* testRdbStore0003 end *************");
try{
dataRdb.getRdbStore(storeConfig, 4).then(async (ret) => {
console.info(TAG + "getRdbStore done" + ret);
expect(null).assertFail();
}).catch((err) => {
console.info(TAG + "getRdbStore with wrong path");
})
expect(false).assertTrue();
}catch(error){
console.info(TAG + `catch err: failed: err: code= ${error.code}, message = ${error.message}`)
expect(error.code).assertEqual("401")
done();
console.info(TAG + "************* testRdbStore0003 end *************");
}
})
/**
......
......@@ -178,12 +178,12 @@ describe('rdbStoreV9Test', function () {
}else{
console.info(TAG + "create table success")
}
done();
dataRdb.deleteRdbStore(context,"secure.db").then(()=>{
console.info(TAG + "Delete rdbstore success")
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100 end *************");
})
});
await dataRdb.deleteRdbStore(context,"secure.db");
await sleep(1000)
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100 end *************");
})
/**
......@@ -205,12 +205,11 @@ describe('rdbStoreV9Test', function () {
}else{
console.info(TAG + "create table success")
}
done();
dataRdb.deleteRdbStore(context, "secure.db").then(() => {
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200 end *************");
})
});
await dataRdb.deleteRdbStore(context,"secure.db");
await sleep(1000)
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200 end *************");
})
/**
......@@ -232,12 +231,11 @@ describe('rdbStoreV9Test', function () {
}else{
console.info(TAG + "create table success")
}
done();
dataRdb.deleteRdbStore(context, "secure.db").then(() => {
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300 end *************");
})
});
await dataRdb.deleteRdbStore(context,"secure.db");
await sleep(1000)
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300 end *************");
})
/**
......@@ -259,12 +257,11 @@ describe('rdbStoreV9Test', function () {
}else{
console.info(TAG + "get rdb store success")
}
done();
dataRdb.deleteRdbStore(context,"secure.db").then(() => {
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 end *************");
})
});
await dataRdb.deleteRdbStore(context,"secure.db");
await sleep(1000)
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 end *************");
})
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册