Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
gitlab-ci-android
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸大学计算机学院
教师群组
宋海霞-shx
androidTest
gitlab-ci-android
提交
ca0b8bcd
提交
ca0b8bcd
11月 02, 2016
创建
作者:
Greyson Parrelli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added functional tests.
上级
f851e7e2
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
62 行增加
和
3 行删除
+62
-3
.gitlab-ci.yml
.gitlab-ci.yml
+15
-2
build.gradle
app/build.gradle
+1
-0
AddingTest.java
.../java/com/greysonparrelli/gitlabciandroid/AddingTest.java
+6
-1
TestBase.java
...st/java/com/greysonparrelli/gitlabciandroid/TestBase.java
+40
-0
没有找到文件。
.gitlab-ci.yml
浏览文件 @
ca0b8bcd
...
@@ -17,14 +17,14 @@ before_script:
...
@@ -17,14 +17,14 @@ before_script:
-
echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
-
echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
-
echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
-
echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
-
export ANDROID_HOME=$PWD/android-sdk-linux
-
export ANDROID_HOME=$PWD/android-sdk-linux
-
export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
-
chmod +x ./gradlew
-
chmod +x ./gradlew
stages
:
stages
:
-
build
-
test
-
test
build
:
build
:
stage
:
build
stage
:
test
script
:
script
:
-
./gradlew assembleDebug
-
./gradlew assembleDebug
artifacts
:
artifacts
:
...
@@ -35,3 +35,15 @@ unitTests:
...
@@ -35,3 +35,15 @@ unitTests:
stage
:
test
stage
:
test
script
:
script
:
-
./gradlew test
-
./gradlew test
functionalTests
:
stage
:
test
script
:
-
wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator
-
chmod +x android-wait-for-emulator
-
echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter sys-img-x86-google_apis-${ANDROID_TARGET_SDK}
-
echo no | android-sdk-linux/tools/android create avd -n test -t android-${ANDROID_TARGET_SDK} --abi google_apis/x86
-
android-sdk-linux/tools/emulator64-x86 -avd test -no-window -no-audio &
-
./android-wait-for-emulator
-
adb shell input keyevent 82
-
./gradlew cAT
\ No newline at end of file
app/build.gradle
浏览文件 @
ca0b8bcd
...
@@ -26,4 +26,5 @@ dependencies {
...
@@ -26,4 +26,5 @@ dependencies {
})
})
compile
'com.android.support:appcompat-v7:25.0.0'
compile
'com.android.support:appcompat-v7:25.0.0'
testCompile
'junit:junit:4.12'
testCompile
'junit:junit:4.12'
androidTestCompile
'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}
}
app/src/androidTest/java/com/greysonparrelli/gitlabciandroid/AddingTest.java
浏览文件 @
ca0b8bcd
...
@@ -21,11 +21,16 @@ import static android.support.test.espresso.matcher.ViewMatchers.withText;
...
@@ -21,11 +21,16 @@ import static android.support.test.espresso.matcher.ViewMatchers.withText;
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
*/
@RunWith
(
AndroidJUnit4
.
class
)
@RunWith
(
AndroidJUnit4
.
class
)
public
class
AddingTest
{
public
class
AddingTest
extends
TestBase
{
@Rule
@Rule
public
ActivityTestRule
<
MainActivity
>
mActivityRule
=
new
ActivityTestRule
<>(
MainActivity
.
class
);
public
ActivityTestRule
<
MainActivity
>
mActivityRule
=
new
ActivityTestRule
<>(
MainActivity
.
class
);
@Override
ActivityTestRule
getActivityRule
()
{
return
mActivityRule
;
}
@Test
@Test
public
void
addNumbers
()
throws
Exception
{
public
void
addNumbers
()
throws
Exception
{
// Enter numbers to be added
// Enter numbers to be added
...
...
app/src/androidTest/java/com/greysonparrelli/gitlabciandroid/TestBase.java
0 → 100644
浏览文件 @
ca0b8bcd
package
com
.
greysonparrelli
.
gitlabciandroid
;
import
android.app.Activity
;
import
android.os.RemoteException
;
import
android.support.test.InstrumentationRegistry
;
import
android.support.test.rule.ActivityTestRule
;
import
android.support.test.uiautomator.UiDevice
;
import
android.view.WindowManager
;
import
org.junit.Before
;
/**
* Serves as a base test that will make sure that the screen is unlocked.
*
* @author Greyson Parrelli (keybase.io/greyson)
*/
public
abstract
class
TestBase
{
@Before
public
void
setup
()
{
UiDevice
device
=
UiDevice
.
getInstance
(
InstrumentationRegistry
.
getInstrumentation
());
try
{
device
.
wakeUp
();
}
catch
(
RemoteException
e
)
{
e
.
printStackTrace
();
}
final
Activity
activity
=
getActivityRule
().
getActivity
();
Runnable
wakeUpDevice
=
new
Runnable
()
{
public
void
run
()
{
activity
.
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TURN_SCREEN_ON
|
WindowManager
.
LayoutParams
.
FLAG_SHOW_WHEN_LOCKED
|
WindowManager
.
LayoutParams
.
FLAG_KEEP_SCREEN_ON
);
}
};
activity
.
runOnUiThread
(
wakeUpDevice
);
}
abstract
ActivityTestRule
getActivityRule
();
}
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论