0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00

Get tests working

This commit is contained in:
timrae 2014-11-10 21:10:07 +09:00
parent 392a788d68
commit 4dd2ac2cad
14 changed files with 9 additions and 165 deletions

View File

@ -8,6 +8,7 @@ android {
applicationId "com.ichi2.anki"
minSdkVersion 7
targetSdkVersion 19
testApplicationId "com.ichi2.anki.tests"
}
signingConfigs {
release {

View File

@ -14,9 +14,10 @@
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
package com.ichi2.utils;
package com.ichi2.anki.tests;
import android.test.AndroidTestCase;
import com.ichi2.utils.*;
/**
* Unit tests for {@link HtmlUtil}.

View File

@ -13,8 +13,7 @@
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
package com.ichi2.utils;
package com.ichi2.anki.tests;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.Suppress;
@ -23,12 +22,15 @@ import com.ichi2.anki.BackupManager;
import com.ichi2.anki.exception.APIVersionException;
import com.ichi2.libanki.Collection;
import com.ichi2.libanki.Note;
import com.ichi2.libanki.Media;
import com.ichi2.anki.tests.Shared;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import com.ichi2.utils.*;
/**
* Unit tests for {@link Media}.

View File

@ -14,7 +14,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
package com.ichi2.utils;
package com.ichi2.anki.tests;
import com.ichi2.anki.AnkiDroidApp;
import com.ichi2.anki.BackupManager;

View File

@ -47,12 +47,6 @@
This ensures the correct ordering between the various types of releases (dev < alpha < beta < release) which is
needed for upgrades to be offered correctly.
-->
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.ichi2.anki" >
</instrumentation>
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="19" />

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry combineaccessrules="false" kind="src" path="/AnkiDroid"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>AnkiDroid-Tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,4 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ichi2.anki.tests"
android:versionCode="1"
android:versionName="1.0">
<!-- We add an application tag here just so that we can indicate that
this package needs to link against the android.test library,
which is needed when building test cases. -->
<application>
<uses-library android:name="android.test.runner" />
</application>
<!--
This declares that this application uses the instrumentation test runner targeting
the package of com.ichi2.anki. To run the tests use the command:
"adb shell am instrument -w com.ichi2.anki.tests/android.test.InstrumentationTestRunner"
-->
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.ichi2.anki"
android:label="Tests for com.ichi2.anki"/>
</manifest>

View File

@ -1,30 +0,0 @@
This directory contains tests and a test project for AnkiDroid.
You can import this project into Eclipse as you did for the main project. You
can also run the tests from the command line with:
ant clean debug test
Make sure you have installed a version of the application that you have build before running the test. You can do some from the command line with:
cd ..
ant clean debug install
cd tests
The output of the tests should look something like:
test:
[echo] Running tests ...
[exec]
[exec] com.ichi2.utils.HtmlUtilTest:......
[exec] Test results for InstrumentationTestRunner=......
[exec] Time: 0.058
[exec]
[exec] OK (6 tests)
[exec]
[exec]
assuming all the tests are passing.
The test classes and the number of tests is subject to change.

View File

@ -1,18 +0,0 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked into Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
tested.project.dir=..

View File

@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19

View File

@ -1,4 +0,0 @@
This file left intentionally blank.
It guarantees that the directory it lives in is created when checking out the
repository.