/** * @return the includedGroups. */ public List<String> getIncludedGroups() { List<String> result = Lists.newArrayList(); if (m_xmlGroups != null && m_xmlGroups.getRun() != null) { result.addAll(m_xmlGroups.getRun().getIncludes()); } result.addAll(m_suite.getIncludedGroups()); return Collections.unmodifiableList(result); }
/** * @return Returns the includedGroups. * Note: do not modify the returned value, use {@link #addIncludedGroup(String)}. */ public List<String> getIncludedGroups() { if (m_parentSuite != null) { return m_parentSuite.getIncludedGroups(); } else if (m_xmlGroups != null && (m_xmlGroups.getRun() != null)) { return m_xmlGroups.getRun().getIncludes(); } else { // deprecated return m_includedGroups; } }
/** @return the includedGroups. */ public List<String> getIncludedGroups() { List<String> result = Lists.newArrayList(); if (m_xmlGroups != null && m_xmlGroups.getRun() != null) { result.addAll(m_xmlGroups.getRun().getIncludes()); } result.addAll(getSuite().getIncludedGroups()); return Collections.unmodifiableList(result); }
Assert.assertEquals(s.getIncludedGroups(), Arrays.asList("includeThisGroup")); Assert.assertEquals(s.getExcludedGroups(), Arrays.asList("excludeThisGroup")); XmlGroups groups = s.getGroups();
/** * @return Returns the includedGroups. Note: do not modify the returned value, use {@link * #addIncludedGroup(String)}. */ public List<String> getIncludedGroups() { if (m_parentSuite != null) { return m_parentSuite.getIncludedGroups(); } else if (m_xmlGroups != null && (m_xmlGroups.getRun() != null)) { return m_xmlGroups.getRun().getIncludes(); } else { // deprecated return m_includedGroups; } }
@Test public void testIncludedAndExcludedGroups() { XmlSuite suite = new XmlSuite(); suite.addIncludedGroup("foo"); suite.addExcludedGroup("bar"); assertThat(suite.getIncludedGroups()).containsExactly("foo"); assertThat(suite.getExcludedGroups()).containsExactly("bar"); }
@Test public void testIncludedAndExcludedGroupsWithRun() { XmlRun xmlRun = new XmlRun(); xmlRun.onInclude("foo"); xmlRun.onExclude("bar"); XmlGroups groups = new XmlGroups(); groups.setRun(xmlRun); XmlSuite suite = new XmlSuite(); suite.setGroups(groups); assertThat(suite.getIncludedGroups()).containsExactly("foo"); assertThat(suite.getExcludedGroups()).containsExactly("bar"); }
@Test(description = "GITHUB-1878") public void ensureSkipInfoHasFailedTestDetailsWhenInvolvingGroups() { XmlSuite xmlSuite = createXmlSuite("sample_suite"); createXmlTest(xmlSuite, "sample_test", TestClassWithGroupFailures.class); xmlSuite.getIncludedGroups().addAll(Arrays.asList("unit", "integration")); TestNG testng = create(xmlSuite); ReasonReporter reporter = new ReasonReporter(); testng.addListener(reporter); testng.run(); Map<String, String> expected = Maps.newHashMap(); expected.put("integrationTests", "unitTests"); assertThat(reporter.getSkippedInfo()).containsAllEntriesOf(expected); }
@Test(description = "GITHUB-1878") public void ensureSkipInfoHasFailedTestDetailsWhenInvolvingMultipleGroups() { XmlSuite xmlSuite = createXmlSuite("sample_suite"); createXmlTest(xmlSuite, "sample_test", TestClassWithMultipleGroupFailures.class); xmlSuite.getIncludedGroups().addAll(Arrays.asList("p1", "p2", "all")); TestNG testng = create(xmlSuite); ReasonReporter reporter = new ReasonReporter(); testng.addListener(reporter); testng.run(); assertThat(reporter.getSkippedInfo()).containsAnyOf(entry("child", "father,mother"), entry("child", "mother,father")); }
List<String> included = xmlSuite.getIncludedGroups(); List<String> excluded = xmlSuite.getExcludedGroups(); if (hasElements(included) || hasElements(excluded)) {
List<String> included = xmlSuite.getIncludedGroups(); List<String> excluded = xmlSuite.getExcludedGroups(); if (hasElements(included) || hasElements(excluded)) {
/** * {@inheritDoc} * Note that this is not a full clone: XmlTest children are not cloned by this * method. */ @Override public Object clone() { XmlSuite result = shallowCopy(); result.setExcludedGroups(getExcludedGroups()); result.setIncludedGroups(getIncludedGroups()); result.setGroupByInstances(getGroupByInstances()); result.setGroups(getGroups()); result.setMethodSelectors(getXmlMethodSelectors()); result.setPackages(getPackages()); result.setParentSuite(getParentSuite()); result.setPreserveOrder(getPreserveOrder()); result.setSuiteFiles(getSuiteFiles()); result.setTests(getTests()); result.setXmlMethodSelectors(getXmlMethodSelectors()); return result; }
/** * {@inheritDoc} Note that this is not a full clone: XmlTest children are not cloned by this * method. */ @Override public Object clone() { XmlSuite result = shallowCopy(); result.setExcludedGroups(getExcludedGroups()); result.setIncludedGroups(getIncludedGroups()); result.setGroupByInstances(getGroupByInstances()); result.setGroups(getGroups()); result.setMethodSelectors(getXmlMethodSelectors()); result.setPackages(getPackages()); result.setParentSuite(getParentSuite()); result.setPreserveOrder(getPreserveOrder()); result.setSuiteFiles(getSuiteFiles()); result.setTests(getTests()); result.setXmlMethodSelectors(getXmlMethodSelectors()); return result; }