Run FunSuite from command line without TestNG or JUnit

77 views
Skip to first unread message

Erick Stone

unread,
Aug 28, 2013, 8:12:14 PM8/28/13
to scalate...@googlegroups.com
So, I have a simple ScalaTest test.
The code below runs fine in IntelliJ. It updates fine with Maven.
I want however to be able to run this from command line.
Is there a way to run it from command line without TestNG or JUnit?
I am too new to Maven and ScalaTest to dig in deep on this one unfortunately.

I was thinking something like.

mvn scalatest:run -Dtest=ExampleTest
or
mvn -Dtest=ExampleTest test

This is what I have so far from my internet perusing.
------------------------------------------------------------------------------------------------------

class ExampleTest extends FunSuite {

  test("Example Simple Test") {
    assert(1 === 1)
  }
}

-------------------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
    <modelVersion>4.0.0</modelVersion>
    <groupId>groupId</groupId>
    <artifactId>artifact</artifactId>
    <version>1.0</version>

    <repositories>
        <repository>
            <id>Scala-Tools</id>
            <name>Scala-Tools</name>
            <url>http://scala-tools.org/repo-releases/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_2.10</artifactId>
            <version>2.0.M5b</version>
        </dependency>
        <dependency>
            <groupId>org.lds.qa</groupId>
            <artifactId>scalaStack</artifactId>
            <version>1.0.4</version>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/test/scala</sourceDirectory>
        <testSourceDirectory>src/test/scala</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
                <version>1.0-M2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                    <filereports>WDF TestSuite.txt</filereports>
                </configuration>
            </plugin>
        </plugins>
    </build>

Bill Venners

unread,
Aug 28, 2013, 8:17:07 PM8/28/13
to scalate...@googlegroups.com
Hi Erick,

Welcome!

You can run it using org.scalatest.run as described on this page:

http://www.scalatest.org/user_guide/writing_your_first_test

You could also run it from the ScalaTest Shell in the Scala REPL as described here:

http://www.scalatest.org/user_guide/using_the_scalatest_shell

Or fire up the power tool, Runner, as described here:

http://www.scalatest.org/user_guide/using_the_runner

If you're using a 2.0 milestone or snap version, then you have more commands at your fingertips, described here:

http://www.artima.com/docs-scalatest-2.0.M5b/#org.scalatest.tools.Runner$

Bill


--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Bill Venners
Artima, Inc.
http://www.artima.com

Erick Stone

unread,
Aug 30, 2013, 1:23:57 PM8/30/13
to scalate...@googlegroups.com
Hey Bill,

And to incorporate Maven?
All of the Scala-Maven-Plugin examples seemed to be using TestNG or JUnit.
Our tests however don't use either of those.

Thanks,
Erick Stone
Reply all
Reply to author
Forward
0 new messages