XmlTestRunListener

public class XmlTestRunListener
extends Object implements ITestRunListener

java.lang.Object
   ↳ com.android.ddmlib.testrunner.XmlTestRunListener


यह विकल्प, JUnit के नतीजों को एक्सएमएल फ़ाइलों में लिखता है. यह फ़ॉर्मैट, Ant के XMLJUnitResultFormatter के फ़ॉर्मैट के मुताबिक होता है.

यह हर टेस्ट रन के लिए एक अलग एक्सएमएल फ़ाइल बनाता है.

खास जानकारी

सार्वजनिक कंस्ट्रक्टर

XmlTestRunListener()

पब्लिक मेथड

void addSystemError(String systemError)

सिस्टम की गड़बड़ी का मैसेज जोड़ा गया.

TestRunResult getRunResult()

TestRunResult दिखाता है

String getSystemError()

यह फ़ंक्शन, सिस्टम की गड़बड़ी का मैसेज दिखाता है. इसे "system-err" एलिमेंट में एक्सएमएल फ़ाइल में लिखा जाता है.

void setHostName(String hostName)
void setReportDir(File file)

इस विकल्प का इस्तेमाल करके, रिपोर्ट फ़ाइल सेट की जाती है.

void testAssumptionFailure(TestIdentifier test, String trace)

इस फ़ंक्शन को तब कॉल किया जाता है, जब कोई ऐटॉमिक टेस्ट यह फ़्लैग करता है कि वह ऐसी शर्त मान रहा है जो गलत है

void testEnded(TestIdentifier test, Map<String, String> testMetrics)

यह कुकी, किसी टेस्ट केस के खत्म होने की जानकारी देती है.

void testFailed(TestIdentifier test, String trace)

यह किसी टेस्ट केस के फ़ेल होने की जानकारी देता है.

void testIgnored(TestIdentifier test)

इस फ़ंक्शन को तब कॉल किया जाता है, जब कोई टेस्ट नहीं चलाया जाता. आम तौर पर, ऐसा इसलिए होता है, क्योंकि टेस्ट के तरीके को org.junit.Ignore के साथ एनोटेट किया जाता है.

void testRunEnded(long elapsedTime, Map<String, String> runMetrics)

यह कुकी, टेस्ट रन के खत्म होने की जानकारी देती है.

void testRunFailed(String errorMessage)

गंभीर गड़बड़ी की वजह से, रिपोर्ट के टेस्ट रन को पूरा नहीं किया जा सका.

void testRunStarted(String runName, int numTests)

यह कुकी, टेस्ट रन शुरू होने की जानकारी देती है.

void testRunStopped(long elapsedTime)

उपयोगकर्ता के अनुरोध की वजह से, रिपोर्ट के टेस्ट रन को पूरा होने से पहले ही रोक दिया गया.

void testStarted(TestIdentifier test)

यह फ़ंक्शन, किसी टेस्ट केस के शुरू होने की जानकारी देता है.

प्रोटेक्टेड मेथड

Map<String, String> getPropertiesAttributes()

टेस्ट रिपोर्ट में शामिल करने के लिए, प्रॉपर्टी एट्रिब्यूट को की-वैल्यू पेयर के तौर पर पाएं.

File getResultFile(File reportDir)

यह फ़ंक्शन, एक File बनाता है. इसमें रिपोर्ट बनाई जाएगी.

String getTestName(TestIdentifier testId)
String getTestSuiteName()

सार्वजनिक कंस्ट्रक्टर

XmlTestRunListener

public XmlTestRunListener ()

पब्लिक मेथड

addSystemError

public void addSystemError (String systemError)

सिस्टम की गड़बड़ी का मैसेज जोड़ा गया.

पैरामीटर
systemError String

getRunResult

public TestRunResult getRunResult ()

TestRunResult दिखाता है

रिटर्न
TestRunResult टेस्ट रन के नतीजे.

getSystemError

public String getSystemError ()

यह फ़ंक्शन, सिस्टम की गड़बड़ी का मैसेज दिखाता है. इसे "system-err" एलिमेंट में एक्सएमएल फ़ाइल में लिखा जाता है. अगर यह फ़ंक्शन खाली स्ट्रिंग दिखाता है, तो एलिमेंट नहीं बनाया जाता.

रिटर्न
String

setHostName

public void setHostName (String hostName)

पैरामीटर
hostName String

setReportDir

public void setReportDir (File file)

इस विकल्प का इस्तेमाल करके, रिपोर्ट फ़ाइल सेट की जाती है.

पैरामीटर
file File

testAssumptionFailure

public void testAssumptionFailure (TestIdentifier test, 
                String trace)

इस फ़ंक्शन को तब कॉल किया जाता है, जब कोई ऐटॉमिक टेस्ट यह फ़्लैग करता है कि वह ऐसी शर्त मान रहा है जो गलत है

पैरामीटर
test TestIdentifier: इससे टेस्ट की पहचान होती है

trace String: गड़बड़ी का स्टैक ट्रेस

testEnded

public void testEnded (TestIdentifier test, 
                Map<String, String> testMetrics)

यह कुकी, किसी टेस्ट केस के खत्म होने की जानकारी देती है.

अगर testFailed(TestIdentifier, String) को लागू नहीं किया गया है, तो यह टेस्ट पास हो गया है. यह टेस्ट केस के एक्ज़ीक्यूशन के दौरान, जनरेट हुई किसी भी कुंजी/वैल्यू मेट्रिक को भी दिखाता है.

पैरामीटर
test TestIdentifier: इससे टेस्ट की पहचान होती है

testMetrics Map: android.app.Instrumentation#sendStatus की ओर से टेस्ट केस को लागू करने के दौरान, जनरेट की गई मेट्रिक का Map. अगर एक ही कुंजी को कई बार नहीं भेजा जाता है, तो डालने का क्रम बना रहता है. ध्यान दें कि IInstrumentationResultParser.StatusKeys में तय की गई स्टैंडर्ड कुंजियों को इस मैप से फ़िल्टर कर दिया जाता है. Ddmlib, IInstrumentationResultParser.StatusKeys में तय की गई अतिरिक्त टेस्ट मेट्रिक जोड़ सकता है.

testFailed

public void testFailed (TestIdentifier test, 
                String trace)

यह किसी टेस्ट केस के फ़ेल होने की जानकारी देता है.

इसे testStarted और testEnded के बीच कॉल किया जाएगा.

पैरामीटर
test TestIdentifier: इससे टेस्ट की पहचान होती है

trace String: गड़बड़ी का स्टैक ट्रेस

testIgnored

public void testIgnored (TestIdentifier test)

इस फ़ंक्शन को तब कॉल किया जाता है, जब कोई टेस्ट नहीं चलाया जाता. आम तौर पर, ऐसा इसलिए होता है, क्योंकि टेस्ट के तरीके को org.junit.Ignore के साथ एनोटेट किया जाता है.

पैरामीटर
test TestIdentifier: इससे टेस्ट की पहचान होती है

testRunEnded

public void testRunEnded (long elapsedTime, 
                Map<String, String> runMetrics)

यह कुकी, टेस्ट रन के खत्म होने की जानकारी देती है.

पैरामीटर
elapsedTime long: डिवाइस ने मिलीसेकंड में बीता हुआ समय रिपोर्ट किया

runMetrics Map: android.app.Instrumentation#addResults की ओर से टेस्ट केस को लागू करने के दौरान, जनरेट की गई मेट्रिक का Map. अगर एक ही कुंजी को कई बार नहीं भेजा जाता है, तो डालने का क्रम बना रहता है. ध्यान दें कि IInstrumentationResultParser.StatusKeys में तय की गई स्टैंडर्ड कुंजियों को इस मैप से फ़िल्टर कर दिया जाता है. Ddmlib, IInstrumentationResultParser.StatusKeys में तय की गई अतिरिक्त टेस्ट मेट्रिक जोड़ सकता है.

testRunFailed

public void testRunFailed (String errorMessage)

गंभीर गड़बड़ी की वजह से, रिपोर्ट के टेस्ट रन को पूरा नहीं किया जा सका.

पैरामीटर
errorMessage String: String, रन फ़ेल होने की वजह के बारे में बताता है.

testRunStarted

public void testRunStarted (String runName, 
                int numTests)

यह कुकी, टेस्ट रन शुरू होने की जानकारी देती है.

पैरामीटर
runName String: टेस्ट रन का नाम

numTests int: टेस्ट रन में कुल टेस्ट की संख्या

testRunStopped

public void testRunStopped (long elapsedTime)

उपयोगकर्ता के अनुरोध की वजह से, रिपोर्ट के टेस्ट रन को पूरा होने से पहले ही रोक दिया गया.

पैरामीटर
elapsedTime long: डिवाइस ने मिलीसेकंड में बीता हुआ समय रिपोर्ट किया

testStarted

public void testStarted (TestIdentifier test)

यह फ़ंक्शन, किसी टेस्ट केस के शुरू होने की जानकारी देता है.

पैरामीटर
test TestIdentifier: इससे टेस्ट की पहचान होती है

प्रोटेक्टेड मेथड

getPropertiesAttributes

protected Map<String, String> getPropertiesAttributes ()

टेस्ट रिपोर्ट में शामिल करने के लिए, प्रॉपर्टी एट्रिब्यूट को की-वैल्यू पेयर के तौर पर पाएं.

रिटर्न
Map<String, String>

getResultFile

protected File getResultFile (File reportDir)

यह फ़ंक्शन, एक File बनाता है. इसमें रिपोर्ट बनाई जाएगी.

पैरामीटर
reportDir File: रिपोर्ट की रूट डायरेक्ट्री.

रिटर्न
File एक फ़ाइल

थ्रो
java.io.IOException
IOException

getTestName

protected String getTestName (TestIdentifier testId)

पैरामीटर
testId TestIdentifier

रिटर्न
String

getTestSuiteName

protected String getTestSuiteName ()

रिटर्न
String