001: package test.dependent;
002:
003: import org.testng.TestNG;
004:
005: import test.BaseTest;
006:
007: public class DependentTest extends BaseTest {
008:
009: // /**
010: // * @testng.test groups = "current"
011: // */
012: // public void multiThreadDependencies() {
013: // addClass("test.dependent.SampleDependentMethods");
014: // setThreadCount(2);
015: // setParallel(true);
016: //
017: // run();
018: //
019: // String[] passed = {
020: // "oneA", "oneB", "secondA", "thirdA", "canBeRunAnytime"
021: // };
022: // String[] failed = {
023: // };
024: //
025: // verifyTests("Passed", passed, getPassedTests());
026: // verifyTests("Failed", failed, getFailedTests());
027: // }
028:
029: /**
030: * @testng.test
031: */
032: public void simpleSkip() {
033: addClass("test.dependent.SampleDependent1");
034: run();
035: String[] passed = {};
036: String[] failed = { "fail" };
037: String[] skipped = { "shouldBeSkipped" };
038: verifyTests("Passed", passed, getPassedTests());
039: verifyTests("Failed", failed, getFailedTests());
040: verifyTests("Skipped", skipped, getSkippedTests());
041: }
042:
043: /**
044: * @testng.test
045: */
046: public void dependentMethods() {
047: addClass("test.dependent.SampleDependentMethods");
048: run();
049: String[] passed = { "oneA", "oneB", "secondA", "thirdA",
050: "canBeRunAnytime" };
051: String[] failed = {};
052: String[] skipped = {};
053: verifyTests("Passed", passed, getPassedTests());
054: verifyTests("Failed", failed, getFailedTests());
055: verifyTests("Skipped", skipped, getSkippedTests());
056: }
057:
058: /**
059: * @testng.test
060: */
061: public void dependentMethodsWithSkip() {
062: addClass("test.dependent.SampleDependentMethods4");
063: run();
064: String[] passed = { "step1", };
065: String[] failed = { "step2", };
066: String[] skipped = { "step3" };
067: verifyTests("Passed", passed, getPassedTests());
068: verifyTests("Failed", failed, getFailedTests());
069: verifyTests("Skipped", skipped, getSkippedTests());
070: }
071:
072: /**
073: * @testng.test
074: * @testng.expected-exceptions value="org.testng.TestNGException"
075: */
076: public void dependentMethodsWithNonExistentMethod() {
077: addClass("test.dependent.SampleDependentMethods5");
078: run();
079: String[] passed = { "step1", "step2" };
080: String[] failed = {};
081: String[] skipped = {};
082: verifyTests("Passed", passed, getPassedTests());
083: verifyTests("Failed", failed, getFailedTests());
084: verifyTests("Skipped", skipped, getSkippedTests());
085: }
086:
087: /**
088: * @testng.test
089: * @testng.expected-exceptions value="org.testng.TestNGException"
090: */
091: public void dependentMethodsWithCycle() {
092: addClass("test.dependent.SampleDependentMethods6");
093: run();
094: String[] passed = { "step1", "step2" };
095: String[] failed = {};
096: String[] skipped = {};
097: verifyTests("Passed", passed, getPassedTests());
098: verifyTests("Failed", failed, getFailedTests());
099: verifyTests("Skipped", skipped, getSkippedTests());
100: }
101: } // DependentTest
|