summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkh5325.kim <kh5325.kim@samsung.com>2013-08-28 21:33:38 +0900
committerGerrit Code Review <gerrit2@system.s-core.co.kr>2013-08-28 21:33:38 +0900
commit80ef331623e5ff552577c4280fbab8e21478f0fd (patch)
treecb896ad3151317028f20892f0c06c03c4fa996d2
parent4d684785a4874919d48fdafdb794aa131f3e4ffd (diff)
parent3a078365c9ff20476b8f11eccb87cb65c0ca64b6 (diff)
downloadcommon-eplugin-80ef331623e5ff552577c4280fbab8e21478f0fd.tar.gz
common-eplugin-80ef331623e5ff552577c4280fbab8e21478f0fd.tar.bz2
common-eplugin-80ef331623e5ff552577c4280fbab8e21478f0fd.zip
Merge "[Title] add test suite and fix broken connect test case [Type] [Module] [Priority] [CQ#] [Redmine#] 9903 [Problem] [Cause] [Solution] [TestCase]" into develop
-rw-r--r--org.tizen.common/test/src/org/tizen/common/sdb/ConnectTest.java43
-rw-r--r--org.tizen.common/test/src/org/tizen/common/sdb/InstallTest.java28
-rw-r--r--org.tizen.common/test/src/org/tizen/common/sdb/PullPushTest.java4
-rw-r--r--org.tizen.common/test/src/org/tizen/common/sdb/SdbTestSuite.java47
4 files changed, 98 insertions, 24 deletions
diff --git a/org.tizen.common/test/src/org/tizen/common/sdb/ConnectTest.java b/org.tizen.common/test/src/org/tizen/common/sdb/ConnectTest.java
index b45368dad..cfe4ac7c9 100644
--- a/org.tizen.common/test/src/org/tizen/common/sdb/ConnectTest.java
+++ b/org.tizen.common/test/src/org/tizen/common/sdb/ConnectTest.java
@@ -47,7 +47,7 @@ import org.tizen.common.Pattern;
*/
public class ConnectTest {
- private static final int CONNET_SLEEP = 500;
+ private static final int CONNET_SLEEP = 100;
@BeforeClass
public static void prepareTest() throws Exception{
@@ -77,22 +77,29 @@ public class ConnectTest {
try {
int port = getPorts()[0];
run( SDB_PATH + " disconnect");
- run( SDB_PATH + " connect " + LOOPBACK_IP + ":" + (port + 1));
+ run( SDB_PATH + " connect " + LOOPBACK_IP + ":" + port);
Thread.sleep(CONNET_SLEEP);
boolean success = false;
+ String errMsg = "";
for(int i=0; i < MAX_TRIAL; i++) {
final ConnectResult result = run( SDB_PATH + " devices").expect( new ConnectResult() );
- if(result.tcpPortNums.length > 0) {
+ if(result == null) {
+ errMsg = "result for sdb devices for connect is null";
+ }
+ else if(result.tcpPortNums == null) {
+ errMsg = "tcp port number of sdb devices for connect is null";
+ }
+ else if(result.tcpPortNums.length > 0) {
assertTrue("More than one devices are connected", result.tcpPortNums.length == 1);
int tcpPort = new Integer(result.tcpPortNums[0]);
- assertEquals(String.format("Device port: '%s' and connected port: '%s' are not matched", port + 1, tcpPort), port + 1, tcpPort);
+ assertEquals(String.format("Device port: '%s' and connected port: '%s' are not matched", port, tcpPort), port, tcpPort);
success = true;
break;
}
Thread.sleep(CONNET_SLEEP);
}
- assertTrue("No devices are connected", success);
+ assertTrue(errMsg, success);
}
finally {
run( SDB_PATH + " disconnect");
@@ -121,19 +128,27 @@ public class ConnectTest {
try {
run( SDB_PATH + " disconnect");
int ports[] = getPorts();
- run( SDB_PATH + " connect " + LOOPBACK_IP + ":" + (ports[0] + 1));
+ run( SDB_PATH + " connect " + LOOPBACK_IP + ":" + ports[0]);
Thread.sleep(CONNET_SLEEP);
- run( SDB_PATH + " disconnect " + LOOPBACK_IP + ":" + (ports[0] + 1));
+ run( SDB_PATH + " disconnect " + LOOPBACK_IP + ":" + ports[0]);
boolean success = true;
+ String errMsg = "";
for(int i=0; i< MAX_TRIAL; i++) {
final DisconnectResult result = run( SDB_PATH + " devices").expect( new DisconnectResult() );
- String[] wholeStrings = result.wholeStrings;
-
- for(String wholeString: wholeStrings) {
- if(wholeString.contains(LOOPBACK_IP)) {
- success = false;
- break;
+ if(result == null) {
+ errMsg = "result of sdb devices for disconnect is null";
+ success = false;
+ }
+ else {
+ String[] wholeStrings = result.wholeStrings;
+
+ for(String wholeString: wholeStrings) {
+ if(wholeString.contains(LOOPBACK_IP)) {
+ errMsg = "disconnect failed";
+ success = false;
+ break;
+ }
}
}
if(success) {
@@ -143,7 +158,7 @@ public class ConnectTest {
Thread.sleep(CONNET_SLEEP);
}
- assertTrue("Disconnected fail for the device", success);
+ assertTrue(errMsg, success);
}
finally {
diff --git a/org.tizen.common/test/src/org/tizen/common/sdb/InstallTest.java b/org.tizen.common/test/src/org/tizen/common/sdb/InstallTest.java
index 64a4a60f4..cf0e0f3bb 100644
--- a/org.tizen.common/test/src/org/tizen/common/sdb/InstallTest.java
+++ b/org.tizen.common/test/src/org/tizen/common/sdb/InstallTest.java
@@ -61,7 +61,7 @@ public class InstallTest {
// run( SDB_PATH + " 'kill-server'");
}
- private static final int INSTALL_UNINSTALL_SLEEP = 3000;
+ private static final int INSTALL_UNINSTALL_SLEEP = 1000;
/**
* Test {sdb install, sdb uninstall (native)}
@@ -128,34 +128,48 @@ public class InstallTest {
run( SDB_PATH + String.format(" -s %s uninstall %s", serialNumber, appId));
Thread.sleep(INSTALL_UNINSTALL_SLEEP);
run( SDB_PATH + String.format(" -s %s install %s", serialNumber, copiedName));
- Thread.sleep(INSTALL_UNINSTALL_SLEEP);
boolean success = false;
+ String errMsg = "";
for(int i=0; i < MAX_TRIAL; i++) {
InstallUninstallResult result =
run( SDB_PATH + String.format(" -s %s shell 'pkgcmd' -l | grep %s", serialNumber, appId)).
expect(new InstallUninstallResult());
- if(result != null && result.appId.equals(appId)) {
+ if(result == null) {
+ errMsg = "output of pkgcmd for install is null";
+ }
+ else if(result.appId == null) {
+ errMsg = "output of pkgcmd for install does not have appId";
+ }
+ else if(!result.appId.equals(appId)) {
+ errMsg = MessageFormat.format("output of pkgcmd for install {0} does not equal with {1}", result.appId, appId);
+ }
+ else {
success = true;
break;
}
Thread.sleep(INSTALL_UNINSTALL_SLEEP);
}
- assertTrue(MessageFormat.format("fail to install tpk file {0}", pkgName), success);
+ assertTrue(errMsg, success);
run( SDB_PATH + String.format(" -s %s uninstall %s", serialNumber, appId));
- Thread.sleep(INSTALL_UNINSTALL_SLEEP);
success = false;
for(int i=0; i< MAX_TRIAL; i++) {
InstallUninstallResult result = run( SDB_PATH + String.format(" -s %s shell 'pkgcmd' -l | grep %s", serialNumber, appId)).
expect(new InstallUninstallResult());
- if(result.appId == null) {
+ if(result == null) {
+ errMsg = "output of pkgcmd for uninstall is null";
+ }
+ else if(result.appId != null) {
+ MessageFormat.format("fail to uinstall tpk file {0}", pkgName);
+ }
+ else {
success = true;
break;
}
Thread.sleep(INSTALL_UNINSTALL_SLEEP);
}
- assertTrue(MessageFormat.format("fail to uinstall tpk file {0}", pkgName), success);
+ assertTrue(errMsg, success);
}
finally {
File copiedFile = new File(copiedName);
diff --git a/org.tizen.common/test/src/org/tizen/common/sdb/PullPushTest.java b/org.tizen.common/test/src/org/tizen/common/sdb/PullPushTest.java
index a4ff67943..c3d79ba17 100644
--- a/org.tizen.common/test/src/org/tizen/common/sdb/PullPushTest.java
+++ b/org.tizen.common/test/src/org/tizen/common/sdb/PullPushTest.java
@@ -53,7 +53,7 @@ import org.tizen.common.util.FileUtilTest;
*/
public class PullPushTest {
- private static final int PULL_PUSH_SLEEP = 1000;
+ private static final int PULL_PUSH_SLEEP = 300;
@BeforeClass
public static void prepareTest() throws Exception{
@@ -202,9 +202,7 @@ public class PullPushTest {
}
assertTrue(MessageFormat.format("fail to push directory {0}", pushDir.getAbsolutePath()), success);
- Thread.sleep(PULL_PUSH_SLEEP);
run( SDB_PATH + String.format(" -s %s pull %s %s", serialNumber, targetDst, pullDirName));
- Thread.sleep(PULL_PUSH_SLEEP);
success = false;
for(int i=0; i< MAX_TRIAL; i++) {
diff --git a/org.tizen.common/test/src/org/tizen/common/sdb/SdbTestSuite.java b/org.tizen.common/test/src/org/tizen/common/sdb/SdbTestSuite.java
new file mode 100644
index 000000000..b159761ec
--- /dev/null
+++ b/org.tizen.common/test/src/org/tizen/common/sdb/SdbTestSuite.java
@@ -0,0 +1,47 @@
+/*
+ * Common
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Ho Namkoong <ho.namkoong@samsung.com>
+ * BonYong Lee <bonyong.lee@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.common.sdb;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * <p>
+ * SdbTestSuite
+ *
+ * Test suite for sdb test cases
+ *
+ * </p>
+ *
+ * @author Ho Namkoong{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+@RunWith(Suite.class)
+@SuiteClasses({ ConnectTest.class, DevicesTest.class, InstallTest.class,
+ PullPushTest.class })
+public class SdbTestSuite {
+
+}