How to configure and execute test cases in Azure Devops pipeline

I am new to Appium and testing world.

How to execute the Automated test cases using task “Test with Visual Studio App Center”

In Azure Devops, created the build pipeline with below tasks.
My repository has project files and test case files in separate directory in the repository.
Build task to create the project.apk file and then archieve and signing the project.apk files.
In the Appcenter task “Test with Visual Studio App Center” (App Center Test), have below values
Display name: Test with Visual Studio App Center
Binary application file path: $(build.artifactstagingdirectory)/project.apk
Artifacts directory: $(Build.ArtifactStagingDirectory)/AppCenterTest
Prepare Tests:
Prepare tests: selected (checkbox selected to prepare the Appium tests)
Test framework: Appium
Build directory: $(build.sourcesdirectory)/Test/test_case

  •  this test_case directory has pom.xml in the root directory,*
    
  •   and src/test/java/company/domain/com/android/*.java*
    
  •  and src/test/java/company/domain/com/util/android/*.java*
    

Run Tests:
Authentication Method: App Center Service Connection
App Center service connection: selected service name
App slug: /
Devices: <device_name>
[rest all default values]

What I am trying to achive in the VSTS pipeline?
In the repository, have two directories {source, testcase} in the parent directory.
In the first task, from source directory, create the .apk file and copy to artifacts staging directory.
In the second task, Run the Automated test cases using Appcenter task “Test with Visual Studio App Center”.
I am having trouble understanding on how appium works and make it work.
Finally, i did a local build(mvn test) and it has generated the *.class files. The committed the “test-classes” directory in the test cases build directory “$(build.sourcesdirectory)/Test/test_case”
Then, build pipeline started executing the Appium via pipeline but with dependency error which is copied in the end.

however, I have few issues from the configuration and in build.
Do I need to compile locally using “mvn test” and commit the pre-compiled *.class files in to repository and Appium reads those class files and executes it. Is this the expected behaviour.
Does it not directly take the test cases and compile and upload to Appcenter.
I also have one file /src/test/java/company/domain/com/util/android/UtilSetup.java which has hardcoded values like below.

public class UtilSetupAndroid {
public static EnhancedAndroidDriver driverAndroid;
public static void setupAndroid() throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.ANDROID);
caps.setCapability(“platformVersion”, “7.0”);
caps.setCapability(“deviceName”, “hexa-decimal-value-here”);
caps.setCapability(“udid”, “same-hexa-decimal-value-here”);
caps.setCapability(“appPackage”, “cl.company.transformacion.appcompanymobile”);
caps.setCapability(“appActivity”,
“cl.company.transformacion.appcompanymobile.enrolamiento.activity.CargaInicialActivity”);
caps.setCapability(“app”, “/home/directory/Appium-test/project.apk”);
caps.setCapability(“unicodeKeyboard”, true);
caps.setCapability(“resetKeyboard”, true);
URL url = new URL(“http://localhost:4723/wd/hub”);
driverAndroid = Factory.createAndroidDriver(url, caps);
driverAndroid.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
}

Please suggest below.

  1. How to exectue the Automated test cases via VSTS pipeline using Appcenter task “Test with Visual Studio App Center”
  2. To achieve 1, how the automated test cases should be written? Any design approach or customized ways to write test cases without hard coded values and how to use in vsts.

Earlier, i had similar dependency error. so I added my company public nexus repository in the pom.xml to download the dependencies. but now getting for another dependency which is available in maven central. Kindly help me solve this issue.

Error:
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building run-test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.microsoft.appcenter:appium-test-extension:jar:1.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.958 s
[INFO] Finished at: 2019-06-19T01:45:22+02:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project run-test: Could not resolve dependencies for project com.xamarin.appium:run-test:jar:1.0-SNAPSHOT: Could not find artifact com.microsoft.appcenter:appium-test-extension:jar:1.0 in cache1 (http://cache1:6081/maven2) → [Help 1]