Skip to content
Permalink
Browse files
Move JUnit tests into a separate directory structure, preparation to …
…add AntUnit to the mix

git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/dotnet/trunk@437212 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
bodewig committed Aug 26, 2006
1 parent 90276cc commit 02c35f618c873a9fe6a0c94959d8e43d56535bf9
Showing 7 changed files with 131 additions and 5 deletions.
@@ -21,11 +21,11 @@

<import file="common/build.xml"/>

<target name="test" depends="compile-tests">
<target name="junit-test" depends="compile-tests">
<junit
printsummary="false"
haltonfailure="false"
failureproperty="tests.failed"
failureproperty="junit.tests.failed"
filtertrace="false"
fork="true"
forkmode="once"
@@ -38,12 +38,10 @@
</classpath>

<batchtest>
<fileset dir="src/testcases"/>
<fileset dir="${src.junit}"/>
</batchtest>

<formatter type="plain" usefile="false"/>
</junit>

<fail if="tests.failed">At least one test has failed.</fail>
</target>
</project>
@@ -0,0 +1,64 @@
/*
* Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ant.dotnet;

import org.apache.tools.ant.BuildFileTest;

/**
* Tests the MSBuildTask task.
*/
public class MSBuildTaskTest extends BuildFileTest {

/**
* Description of the Field
*/
private final static String TASKDEFS_DIR = "src/etc/testcases/";

/**
* Constructor
*
* @param name testname
*/
public MSBuildTaskTest(String name) {
super(name);
}

/**
* The JUnit setup method
*/
public void setUp() {
configureProject(TASKDEFS_DIR + "msbuild.xml");
}

public void testEcho() throws Exception {
if (getProject().getProperty("msbuild.found") != null) {
expectLogContaining("echo", "foo is bar");
}
}

public void testNestedFile() throws Exception {
if (getProject().getProperty("msbuild.found") != null) {
expectLogContaining("nested-file", "foo is bar");
}
}

public void testNestedTask() throws Exception {
if (getProject().getProperty("msbuild.found") != null) {
expectLogContaining("nested-task", "foo is bar");
}
}
}
@@ -0,0 +1,64 @@
/*
* Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ant.dotnet;

import org.apache.tools.ant.BuildFileTest;

/**
* Tests the NAntTask task.
*/
public class NAntTaskTest extends BuildFileTest {

/**
* Description of the Field
*/
private final static String TASKDEFS_DIR = "src/etc/testcases/";

/**
* Constructor
*
* @param name testname
*/
public NAntTaskTest(String name) {
super(name);
}

/**
* The JUnit setup method
*/
public void setUp() {
configureProject(TASKDEFS_DIR + "nant.xml");
}

public void testEcho() throws Exception {
if (getProject().getProperty("nant.found") != null) {
expectLogContaining("echo", "foo is bar");
}
}

public void testNestedFile() throws Exception {
if (getProject().getProperty("nant.found") != null) {
expectLogContaining("nested-file", "foo is bar");
}
}

public void testNestedTask() throws Exception {
if (getProject().getProperty("nant.found") != null) {
expectLogContaining("nested-task", "foo is bar");
}
}
}

0 comments on commit 02c35f6

Please sign in to comment.