Hmm, on quick inspection, the junit dependency has
compile scope (instead of test). Also, since you are
using @Before, @Test and @After, you probably do
not need to extend junit.framework.TestCase, although
I am not sure whether it is required that you do not.
But I have not used these junit features enough to be
sure ...
On Nov 14, 2007 10:28 AM, Antollini, Mario <[EMAIL PROTECTED]> wrote:
> Ignacion,
>
> There method to be run is prefixed "test", the class extends
> junit.framework.TestCase and the parent pom is right too.
>
> Here you have the pom:
>
> <project>
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <groupId>org.apache.tuscany.sca</groupId>
> <artifactId>tuscany-tutorial</artifactId>
> <version>1.1-incubating-SNAPSHOT</version>
> <relativePath>../pom.xml</relativePath>
> </parent>
> <artifactId>amazon-cart</artifactId>
> <name>Apache Tuscany SCA Tutorial Amazon Cart</name>
>
> <dependencies>
>
> <dependency>
> <groupId>org.apache.tuscany.sca</groupId>
> <artifactId>tuscany-core</artifactId>
> <version>1.1-incubating-SNAPSHOT</version>
> </dependency>
>
> <dependency>
> <groupId>org.apache.tuscany.sca</groupId>
> <artifactId>tuscany-host-jetty</artifactId>
> <version>1.1-incubating-SNAPSHOT</version>
> <scope>test</scope>
> </dependency>
>
> <dependency>
> <groupId>org.apache.tuscany.sca</groupId>
> <artifactId>tuscany-host-embedded</artifactId>
> <version>1.1-incubating-SNAPSHOT</version>
> </dependency>
>
> <dependency>
> <groupId>org.apache.tuscany.sca</groupId>
> <artifactId>tuscany-implementation-java-runtime</artifactId>
> <version>1.1-incubating-SNAPSHOT</version>
> <scope>test</scope>
> </dependency>
>
> <dependency>
> <groupId>${pom.groupId}</groupId>
> <artifactId>amazon-cart-api</artifactId>
> <version>${pom.version}</version>
> </dependency>
>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>4.2</version>
> <scope>compile</scope>
> </dependency>
>
> </dependencies>
>
> <build>
> <finalName>${artifactId}</finalName>
> <sourceDirectory>${basedir}</sourceDirectory>
> <resources>
> <resource>
> <directory>${basedir}</directory>
> <excludes>
> <exclude>**/*.java</exclude>
> <!--exclude>**/.*/**</exclude -->
> <exclude>pom.xml</exclude>
> <exclude>build.xml</exclude>
> </excludes>
> </resource>
> </resources>
> <plugins>
> <plugin>
> <groupId>org.apache.tuscany.sca</groupId>
> <artifactId>tuscany-maven-ant-generator</artifactId>
> <version>1.1-incubating-SNAPSHOT</version>
> <executions>
> <execution>
> <configuration>
>
> <mainClass>launch.LaunchAmazonCart</mainClass>
> </configuration>
> <goals>
> <goal>generate</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> <dependencies>
> <dependency>
> <groupId>ant</groupId>
> <artifactId>ant-trax</artifactId>
> <version>1.6.5</version>
> </dependency>
> </dependencies>
> </plugin>
> </plugins>
> </build>
>
>
> </project>
>
>
> An here is the test case:
>
>
> package amazon.cart;
>
> import org.apache.tuscany.sca.host.embedded.SCADomain;
> import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
>
> import junit.framework.Assert;
> import org.junit.After;
> import org.junit.Before;
> import org.junit.Test;
>
> import commonj.sdo.DataObject;
> import amazon.cart.AmazonCart;
>
>
> /**
> * Test case for helloworld web service client
> */
> public class AmazonCartTestCase extends junit.framework.TestCase{
>
> private SCADomain scaDomain;
> private AmazonCart amazonCart;
>
> private SCATestCaseRunner server;
>
> @Before
> public void startClient() throws Exception {
> try {
>
> scaDomain =
> SCADomain.newInstance("amazoncart.composite");
> amazonCart = scaDomain.getService(AmazonCart.class,
> "AmazonCartServiceComponent/AmazonCartService");
>
> server = new SCATestCaseRunner(AmazonCartTestCase.class);
> server.before();
>
> } catch (Throwable e) {
> e.printStackTrace();
> }
> }
>
> @Test
> public void testCartCreate() throws Exception {
> System.out.println("Entering test...");
> DataObject root = amazonCart.CartCreate(null);
> //Assert.assertEquals("Hello Smith", msg);
> System.out.println("Exiting test...");
> }
>
>
> @After
> public void stopClient() throws Exception {
> server.after();
> scaDomain.close();
> }
>
>
> }
>
>
> I will really appreciate if you can take a look at them.
>
> Thanks in advance!,
> Mario
>
>
>
> -----Original Message-----
> From: Ignacio Silva-Lepe [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 14, 2007 12:12 PM
> To: [email protected]
> Subject: Re: Adding TestCase?
>
> Oh, and do you have any method with a name starting with
> the 'test' prefix?
>
> On Nov 14, 2007 9:50 AM, Antollini, Mario <[EMAIL PROTECTED]>
> wrote:
> > Hello,
> >
> >
> >
> > I am trying to add a test case for the tutorial. What are the steps I
> > need to follow? I have looked at other test cases and I have copied
> many
> > things (none of them worked though):
> >
> > 1 - create a test case whose class name ends in ***TestCase.java (it
> > cantains the required classes:
> > org.apache.tuscany.sca.host.embedded.SCATestCaseRunner,
> > junit.framework.Assert, org.junit.After, org.junit.Before,
> > org.junit.Test)
> >
> >
> >
> > 2 - Added this to the pom:
> >
> > <dependency>
> >
> > <groupId>junit</groupId>
> >
> > <artifactId>junit</artifactId>
> >
> > <version>4.2</version>
> >
> > <scope>compile</scope>
> >
> > </dependency>
> >
> >
> >
> > 3 - Added this to the pom:
> >
> > <dependency>
> >
> > <groupId>junit</groupId>
> >
> > <artifactId>junit</artifactId>
> >
> > <version>4.2</version>
> >
> > <scope>test</scope>
> >
> > </dependency>
> >
> >
> >
> > 4 - Added this to the pom:
> >
> > <plugin>
> >
> > <groupId>org.apache.maven.plugins</groupId>
> >
> > <artifactId>maven-surefire-plugin</artifactId>
> >
> > <configuration>
> >
> > <argLine> </argLine>
> >
> > </configuration>
> >
> > </plugin>
> >
> >
> >
> > No matter what I try, I always get the "no test to run" response when
> > running maven.
> >
> >
> >
> > Can somebody give me a tip?
> >
> >
> >
> > Regards,
> >
> >
> >
> > Mario E. Antollini
> > Intel Software
> > ASDC
> > +54 351 414 5594
> > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]