Android?????????????????????????
???????????? ???????[ 2013/11/13 15:28:45 ] ????????
???????robotium????Android??y?????????????????TMTS???????????????????????????????Щ?????????????????Android???????????????InstrumentationTestRunner???????y??п???????У????????InstrumentationTestRunner????????????????????????????jenkins??Publish JUnit test result report????????????檔
????1.??????java package????????java??
??????????????????https://code.google.com/p/nbandroid-utils/
??????????????TEST-all.xml??????λ??/data/data/com.example/files???£??????????????????????????root????????鷳????????????????????·??????SD???????λ??SD????/robotium????
package com.example.test.instrumentation;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlSerializer;
import android.content.Context;
import android.os.Bundle;
import android.os.Environment;
/**
* This test runner creates a TEST-all.xml in the files directory of the application under test. The output is compatible with that of the junitreport ant task?? the format
* that is understood by Hudson. Currently this implementation does not implement the all aspects of the junitreport format?? but enough for Hudson to parse the test results.
*/
public class InstrumentationTestRunner extends android.test.InstrumentationTestRunner {
private Writer mWriter;
private XmlSerializer mTestSuiteSerializer;
private long mTestStarted;
private static final String JUNIT_XML_FILE = "TEST-all.xml";
@Override
public void onStart() {
try{
File fileRobo = new File(getTestResultDir(getTargetContext()));
if(!fileRobo.exists()){
fileRobo.mkdir();
}
if(isSDCardAvaliable()){
File resultFile = new File(getTestResultDir(getTargetContext())??JUNIT_XML_FILE);
startJUnitOutput(new FileWriter(resultFile));
}else{
startJUnitOutput(new FileWriter(new File(getTargetContext().getFilesDir()?? JUNIT_XML_FILE)));
}
}
catch(IOException e){
throw new RuntimeException(e);
}
super.onStart();
}
void startJUnitOutput(Writer writer) {
try {
mWriter = writer;
mTestSuiteSerializer = newSerializer(mWriter);
mTestSuiteSerializer.startDocument(null?? null);
mTestSuiteSerializer.startTag(null?? "testsuites");
mTestSuiteSerializer.startTag(null?? "testsuite");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11