Commit c5e22880 authored by Gamage B.G.N.U's avatar Gamage B.G.N.U

ProbabilityCalculationIM updated

parent 6f59d398
package com.elearning.probabilityandstatisticsanalyserandeducator;
import android.app.Activity;
import android.app.Instrumentation;
import android.view.View;
import androidx.test.rule.ActivityTestRule;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.StartingScreen;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.*;
public class WelcomeTest {
@Rule
public ActivityTestRule<Welcome> mActivityTestRule =
new ActivityTestRule<Welcome>(Welcome.class);
Instrumentation.ActivityMonitor monitor = getInstrumentation().addMonitor(StartingScreen.class.getName(),null,false);
private Welcome welcome = null;
@Before
public void setUp() throws Exception {
welcome = mActivityTestRule.getActivity();
}
@Test
public void testLaunch(){
View view = welcome.findViewById(R.id.btn_login);
assertNotNull(view);
onView(withId(R.id.btn_login)).perform(click());
Activity testedFunction = getInstrumentation().waitForMonitorWithTimeout(monitor,35000);
assertNotNull(testedFunction);
testedFunction.finish();
}
@After
public void tearDown() throws Exception {
welcome = null;
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import org.junit.Test;
import static org.junit.Assert.*;
public class DbHelperTest {
@Test
public void isInitialExamFinished() {
int input = 2;
int output = 0;
int expected = 0;
double delta = .1;
DbHelper dbHelper = new DbHelper();
output = dbHelper.isInitialExamFinished(input);
assertEquals(expected,output);
}
@Test
public void userProgressChecker() {
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import org.junit.Test;
import static org.junit.Assert.*;
public class QuizDbHelperTest {
@Test
public void updateIsInitialExamForUsers() {
int input = 2;
int output = 0;
int expected = 1;
QuizDbHelper quizDbHelper = new QuizDbHelper();
output = quizDbHelper.UpdateIsInitialExamForUsers(input);
assertEquals(expected,output);
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import android.app.Activity;
import android.app.Instrumentation;
import android.view.View;
import androidx.test.rule.ActivityTestRule;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import com.elearning.probabilityandstatisticsanalyserandeducator.calculationfunction.DescriptiveStatisticsCalcuation;
import com.elearning.probabilityandstatisticsanalyserandeducator.inputMethod.DescriptiveSCinputMethod;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.*;
public class StartingScreenTest {
@Rule
public ActivityTestRule<StartingScreen> mActivityTestRule =
new ActivityTestRule<StartingScreen>(StartingScreen.class);
Instrumentation.ActivityMonitor monitor = getInstrumentation().addMonitor(QuizActivity.class.getName(),null,false);
private StartingScreen startingScreen = null;
@Before
public void setUp() throws Exception {
startingScreen = mActivityTestRule.getActivity();
}
@Test
public void testLaunch(){
View view = startingScreen.findViewById(R.id.button_start_quiz);
assertNotNull(view);
onView(withId(R.id.button_start_quiz)).perform(click());
Activity testedFunction = getInstrumentation().waitForMonitorWithTimeout(monitor,25000);
assertNotNull(testedFunction);
testedFunction.finish();
}
@After
public void tearDown() throws Exception {
startingScreen = null;
}
}
\ No newline at end of file
......@@ -1218,6 +1218,31 @@ public class QuizDbHelper {
System.out.println("NormalDistributionHarddbhelper "+questionList);
return questionList;
}
public int UpdateIsInitialExamForUsers(int userID){
try {
con = dbConnection.getConnection();
if (con==null){
System.out.println("Connection Error");
}else{
String query = "UPDATE User_SupportData SET is_initial_finished = 1 WHERE user_ID = '"+userID+"'";
//new way to take values into DB
Statement st = con.createStatement();
st.executeUpdate(query);
st.close();
con.close();
System.out.println("isInithialExam is Update ");
}
}catch (Exception e){
e.printStackTrace();
}
return 1;
}
}
......
......@@ -609,8 +609,4 @@ public void showMessege(){
return StringdescriptiveQuestions;
}
}
\ No newline at end of file
......@@ -356,12 +356,12 @@
app:layout_constraintVertical_bias="0.859" />
<Spinner
android:id="@+id/spinner"
android:id="@+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.573"
app:layout_constraintHorizontal_bias="0.705"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.864" />
......
......@@ -88,4 +88,9 @@
<string name="so_upper_half_is">So upper half is</string>
<string name="title_activity_new_nav">new_nav</string>
<string-array name="isDependent">
<item>Dependant</item>
<item>Independant</item>
</string-array>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment