@@ -0,0 +1,1744 @@
+package Espresso;%0A%0Aimport java.util.List;%0Aimport classes.Component;%0Aimport classes.StepTestCase;%0Aimport classes.TestCase;%0A%0A/**%0A * This is the EspressoTranslator class, it takes Action objects and creates Espresso%0A * commands that correspond to those Action objects.%0A * %0A * @author Nathan Chen%0A *%0A */%0Apublic class EspressoTranslator %7B%0A%09%0A%09/**%0A%09 * Constructor for the EspressoTranslator class.%0A%09 */%0A%09public EspressoTranslator()%7B%0A%09%7D%0A%09%0A%09/**%0A%09 * Iterates through all the StepTestCase objects in the stepTestCases List.%0A%09 * @param testCase The current TestCase object being looked at%0A%09 */%0A%09public void steps_iterator(TestCase testCase)%7B%0A%09%09String appName = testCase.getAppName();%0A%09%09String packageName = testCase.getPackageName();%0A%09%09String mainActivity = testCase.getMainActivity();%0A%09%09List%3CStepTestCase%3E stepTestCases = testCase.getSteps();%0A%09%09%0A%09%09for(int i = 0; i %3C stepTestCases.size(); i++)%7B%0A%09%09%09StepTestCase cur = stepTestCases.get(i);%0A%09%09%09espresso_switcher(cur.getAction(), cur);%0A%09%09%7D%0A%09%7D%0A%09%0A%09/**%0A%09 * Switching hub for taking different kinds of input, calls methods depending%0A%09 * on what kind of user input is given.%0A%09 * @param action String of the action to be performed%0A%09 * @param s StepTestCase object being looked at %0A%09 */%0A%09public void espresso_switcher(String action, StepTestCase s)%7B%0A%09%09%0A%09%09if(action.equals(%22CLICK%22))%7B%0A%09%09%09make_click_command(s.getComponent());%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Generates the click command formatted in the Espresso framework%0A%09 * @param c Component object of the current stepTestCase being analyzed%0A%09 */%0A%09private void make_click_command(Component c) %7B%0A%09%09String espresso_command = new String();%09%09%0A%09%09espresso_command += %22onView(withId(R.id.%22 + c.getId().substring(3) + %22)).perform(click());%22;%0A%09%09System.out.println(espresso_command);%0A%09%7D%0A%7D%0A

Create EspressoTranslator.java