Commit ad769c3a authored by Reiner Jung's avatar Reiner Jung

Added babsi to the repository

parent 0efdfdad
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>BabsiApp Test</name>
<comment></comment>
<projects>
<project>BabsiApp</project>
</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>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cau.swp.babsi.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="cau.swp.babsi" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cau.swp.babsi.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="cau.swp.babsi" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
</application>
</manifest>
\ No newline at end of file
# 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 *;
#}
# 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-18
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">BabsiApp Test Test</string>
</resources>
/**
* JayUnit Tests
*/
package cau.swp.babsi.guitest;
import com.jayway.android.robotium.solo.Solo;
import cau.swp.babsi.gui.MainActivity;
import android.test.ActivityInstrumentationTestCase2;
import cau.swp.babsi.R;
/**
* @author DanielJay
*
*/
public class MainActivityTest extends
ActivityInstrumentationTestCase2<MainActivity> {
public Solo solo;
public MainActivityTest() {
super(MainActivity.class);
}
/**
* @throws java.lang.Exception
*/
protected static void setUpBeforeClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
protected static void tearDownAfterClass() throws Exception {
}
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
public void testLogin() {
assertTrue("App nicht korrekt gestartet",
solo.searchText("Einloggen", true));
solo.enterText(0, "user123");
solo.enterText(1, "password");
solo.clickOnText("Einloggen");
assertTrue("Nicht erfolgreich eingeloggt",
solo.searchText("00:00", true));
}
public void testLoginFails() {
assertTrue("Appnicht korrekt gestartet",
solo.searchText("Einloggen", true));
solo.enterText(0, "user123");
solo.enterText(1, "pass");
solo.clickOnText("Einloggen");
assertFalse("Fälschlicherweise eingeloggt",
solo.searchText("00:00", true));
}
public void testWardRound() {
testLogin();
solo.clickOnActionBarItem(R.id.menu_start);
assertTrue("Visite wurde nicht gestartet",
solo.searchText("00:01", true));
solo.clickOnActionBarItem(R.id.menu_add);
assertTrue("Patient hinzufügen wurde nicht geöffnet",
solo.searchText("Patientenbezeichnung", true));
solo.enterText(0, "Mathis Tiberius Neumann");
solo.clickOnEditText(1);
assertTrue("Geburtsdatum ändern wurde nicht geöffnet",
solo.searchText("Fertig", true));
solo.clickOnText("Fertig");
solo.scrollToSide(Solo.RIGHT, (float) 0.9);
solo.clickOnCheckBox(2);
solo.scrollToSide(Solo.RIGHT, (float) 0.9);
solo.clickOnText("HINZUFÜGEN");
assertTrue("Antibiotika hinzufügen wurde nicht geöffnet",
solo.searchText("Antibiotika", true));
solo.enterText(0, "Am");
solo.clickOnText("Amoxicillin");
solo.clickOnEditText(1);
solo.enterText(1, "1");
solo.clickOnText("1g");
solo.pressSpinnerItem(0, 1);
solo.pressSpinnerItem(1, 1);
solo.enterText(2, "5");
solo.clickOnEditText(3);
solo.enterText(3, "1");
solo.clickOnText("alle 48 h 1x");
solo.clickOnEditText(4);
solo.enterText(4, "es");
solo.clickOnText("Eskalation");
solo.pressSpinnerItem(2, 2);
solo.clickOnActionBarItem(R.id.checklist_save);
assertTrue("Antibiotika wurde nicht hinzugefügt",
solo.searchText("Amoxicillin", true));
solo.clickOnActionBarItem(R.id.checklist_save);
assertTrue("Patient wurde gespeichert", solo.searchText("Mathis", true));
solo.clickOnActionBarItem(R.id.menu_stop);
assertTrue("Der Stop Button wurde nicht gedrückt",
solo.searchText("Visite beenden", true));
solo.clickOnText("Ja");
assertTrue("Die Visite wurde nicht korrekt beendet",
solo.searchText("00:00", true));
}
public void testSync() {
testChangeIP();
solo.clickOnActionBarItem(R.id.menu_sync);
assertTrue("Der synchronisieren Dialog hat sich nicht geöffnet",
solo.searchText("Synchronisiert", true));
solo.sleep(8000);
assertTrue("App konnte nicht erfolgreich synchronisieren",
solo.searchText("Einloggen"));
}
public void testChangeIP() {
solo.goBack();
solo.clickOnActionBarItem(R.id.menu_ip);
assertTrue("IP ändern Fenster hat sich nicht geöffnet",
solo.searchText("Server-Adresse", true));
solo.enterText(0, "134.245.229.110");
solo.clickOnText("Ok");
assertFalse("Die IP Adresse war falsch",
solo.searchText("Serverprobleme", true));
solo.sleep(8000);
assertTrue("Der Hauptbildschirm wird wieder angezeigt",
solo.searchText("Einloggen", true));
}
public void testChangeIPFails() {
solo.goBack();
solo.clickOnActionBarItem(R.id.menu_ip);
assertTrue("IP ändern Fenster hat sich nicht geöffnet",
solo.searchText("Server-Adresse", true));
solo.enterText(0, "134.245.229.112");
solo.clickOnText("Ok");
solo.sleep(2000);
assertTrue("Die IP Adresse war richtig",
solo.searchText("Serverprobleme", true));
}
public void testDeleteWardRound() {
testLogin();
solo.clickOnActionBarItem(R.id.menu_start);
assertTrue("Visite wurde nicht gestartet",
solo.searchText("00:01", true));
solo.clickOnActionBarItem(R.id.menu_add);
assertTrue("Patient hinzufügen wurde nicht geöffnet",
solo.searchText("Patientenbezeichnung", true));
solo.enterText(0, "Robin");
solo.clickOnActionBarItem(R.id.checklist_save);
solo.clickLongOnText("Robin");
assertTrue("Checkliste löschen wurde nicht geöffnet",
solo.searchText("Checkliste löschen", true));
solo.clickOnText("Ja");
assertFalse("Checkliste wurde nicht korrekt entfernt",
solo.searchText("Robin", true));
}
public void testLogout() {
testLogin();
solo.clickOnActionBarItem(R.id.menu_logout);
solo.clickOnText("Ja");
assertTrue("Der Benutzer wurde nicht korrekt ausgeloggt",
solo.searchText("Einloggen", true));
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
}
/**
*
*/
package cau.swp.babsi.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.Test;
import cau.swp.babsi.data.Antibiotic;
/**
* @author rmo
*
*/
public class AntibioticTest {
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getDosage()}.
*/
@Test
public void testGetDosage() {
Antibiotic ab = new Antibiotic();
ab.setDosage("Test");
assertEquals("Dosage get correct", ab.getDosage(), "Test");
}
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getTherapy()}.
*/
@Test
public void testGetTherapy() {
Antibiotic ab = new Antibiotic();
ab.setTherapy(3);
assertEquals("Therapy get correct", ab.getTherapy(), 3);
}
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getDuration()}.
*/
@Test
public void testGetDuration() {
Antibiotic ab = new Antibiotic();
ab.setDuration(3);
assertEquals("Duration get correct", ab.getDuration(), 3);
}
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getFrequency()}.
*/
@Test
public void testGetFrequency() {
Antibiotic ab = new Antibiotic();
ab.setFrequency("TestFrequency");
assertEquals("Frequency get correct", ab.getFrequency(), "TestFrequency");
}
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getName()}.
*/
@Test
public void testGetName() {
Antibiotic ab = new Antibiotic();
ab.setName("TestName");
assertEquals("Name get correct", ab.getName(), "TestName");
}
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getInterventionSuggestion()}.
*/
@Test
public void testGetInterventionSuggestion() {
Antibiotic ab = new Antibiotic();
ab.setInterventionSuggestion("TestInterventionSuggestion");
assertEquals("InterventionSuggestion get correct", ab.getInterventionSuggestion(), "TestInterventionSuggestion");
}
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getNotes()}.
*/
@Test
public void testGetNotes() {
Antibiotic ab = new Antibiotic();
ab.setNotes("TestNotes");
assertEquals("Notes get correct", ab.getNotes(), "TestNotes");
}
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getApplicationType()}.
*/
@Test
public void testGetApplicationType() {
Antibiotic ab = new Antibiotic();
ab.setApplicationType(3);
assertEquals("ApplicationType get correct", ab.getApplicationType(), 3);
}
/**
* Test method for {@link cau.swp.babsi.data.Antibiotic#getAcceptance()}.
*/
@Test
public void testGetAcceptance() {
Antibiotic ab = new Antibiotic();
ab.setAcceptance(3);
assertEquals("Acceptance get correct", ab.getAcceptance(), 3);
}
}
/**
*
*/
package cau.swp.babsi.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Date;
import org.junit.Test;
import cau.swp.babsi.data.Antibiotic;
import cau.swp.babsi.data.Checklist;
import cau.swp.babsi.data.WardRound;
/**
* @author rmo
*
*/
public class ChecklistTest {
/**
* Test method for {@link cau.swp.babsi.data.Checklist#getPatientLabel()}.
*/
@Test
public void testGetPatientLabel() {
Checklist cl = new Checklist();
cl.setPatientLabel("Test");
assertEquals("PatientLabel get correct", cl.getPatientLabel(), "Test");
}
/**
* Test method for {@link cau.swp.babsi.data.Checklist#getBirthday()}.
*/
@Test
public void testGetBirthday() {
Checklist cl = new Checklist();
cl.setBirthday(new Date(123));
assertEquals("Birthday get correct", cl.getBirthday(), new Date(123));
}
/**
* Test method for {@link cau.swp.babsi.data.Checklist#getSex()}.
*/
@Test
public void testGetSex() {
Checklist cl = new Checklist();
cl.setSex(false);
assertEquals("Sex get correct", cl.getSex(), false);
}
/**
* Test method for {@link cau.swp.babsi.data.Checklist#getDiagnosis()}.
*/
@Test
public void testGetDiagnosis() {
Checklist cl = new Checklist();
ArrayList<String> diag = new ArrayList<String>();
String dia1 = "1";
String dia2 = "2";
String dia3 = "3";
diag.add(dia1);
diag.add(dia2);
diag.add(dia3);
cl.setDiagnosis(diag);
assertEquals("Diagnosis get correct", cl.getDiagnosis(), diag);
}
/**
* Test method for {@link cau.swp.babsi.data.Checklist#getAntibiotics()}.
*/
@Test
public void testGetAntibiotics() {
Checklist cl = new Checklist();
ArrayList<Antibiotic> ants = new ArrayList<Antibiotic>();
Antibiotic ant1 = new Antibiotic("too much", 2, 3,