trait FilesRunner extends SpecificationsFinder with SystemExit
This trait finds specifications in the source directory, instantiate them as one big specification and report them using the ConsoleReporter or the HtmlReporter depending on the presence of the html flag
- See also
org.specs2.main.Arguments for the regular expression defining the specification names to extract and other options
org.specs2.io.FromSource for the definition of the source directory
- Alphabetic
- By Inheritance
- FilesRunner
- SystemExit
- SpecificationsFinder
- SourceFile
- ConsoleOutput
- Classes
- Output
- FileSystem
- FileWriter
- FileReader
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
afterExecution(specs: Seq[SpecificationStructure])(implicit args: Arguments): Unit
print a message after the execution based on the number of specifications
print a message after the execution based on the number of specifications
- Attributes
- protected
-
def
append(path: String)(function: (Writer) ⇒ Unit): Unit
append some content to a file and take care of closing the file.
append some content to a file and take care of closing the file.
Usage:
write("./dir/hello.txt") { out => out.write("content") }
- path
path of the file to write
- Definition Classes
- FileWriter
-
def
appendToFile(path: String, content: ⇒ String): Unit
writes some content to a file.
writes some content to a file.
- path
path of the file to read
- content
content of the file to write
- Definition Classes
- FileWriter
-
def
appendToXmlFile(path: String, content: ⇒ NodeSeq): Unit
writes some xml content to a file.
writes some xml content to a file.
- path
path of the file to read
- content
content of the file to write
- Definition Classes
- FileWriter
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
beforeExecution(implicit args: Arguments): Unit
print a message before the execution
print a message before the execution
- Attributes
- protected
-
def
canRead(path: String): Boolean
- returns
true if the file can be read
- Definition Classes
- FileSystem
-
def
canWrite(path: String): Boolean
- returns
true if the file can be written
- Definition Classes
- FileSystem
-
def
classNames(packageName: String, content: String, pattern: Pattern, suffix: String, verbose: Boolean = false): Seq[String]
extract the class names corresponding to a pattern found in a content
extract the class names corresponding to a pattern found in a content
- packageName
the base package for the class names
- content
content of a source file
- pattern
a regular expression for a class name
- Definition Classes
- SourceFile
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
copy(input: InputStream, output: OutputStream): Unit
Copy an input stream to an output stream.
Copy an input stream to an output stream.
- input
input stream
- output
output stream
- Definition Classes
- FileSystem
-
def
copyDir(src: String, dest: String): Unit
copy the content of a directory to another.
copy the content of a directory to another.
- dest
destination directory path
- Definition Classes
- FileSystem
-
def
copyFile(path: String, dest: String): Unit
copy a file to a destination directory
copy a file to a destination directory
- path
path of the file to copy
- dest
destination directory path
- Definition Classes
- FileSystem
-
def
copySpecResourcesDir(base: String, src: String, outputDir: String, loader: ClassLoader): Unit
Copy specs resources found either in the specs jar or in the classpath directories to an output directory
Copy specs resources found either in the specs jar or in the classpath directories to an output directory
- base
path of the base package (must not be empty!)
- src
name of the resource directory to copy (relative to the base package)
- outputDir
output directory where to copy the files to
- Definition Classes
- FileSystem
-
def
create[T <: AnyRef](className: String = "", classLoader: ClassLoader = ...)(implicit m: ClassTag[T]): Either[Throwable, T]
- returns
an instance of a given class, returning either the instance, or an exception
- Definition Classes
- Classes
-
def
createArguments(arguments: Array[String]): Arguments
- returns
the Arguments object depending on the command-line options
- Attributes
- protected
-
def
createDir(path: String): Boolean
creates a directory for a given path
creates a directory for a given path
- Definition Classes
- FileSystem
-
def
createFile(path: String): AnyVal
creates a file for a given path.
creates a file for a given path. Create the parent directory if necessary.
- Definition Classes
- FileWriter
-
def
createObject[T <: AnyRef](className: String, printMessage: Boolean, printStackTrace: Boolean)(implicit m: ClassTag[T]): Option[T]
A system property 'debugCreateObject' can be set to override the printMessage and printStackTrace parameters so that the exception message and stacktrace are printed when the object can't be created
A system property 'debugCreateObject' can be set to override the printMessage and printStackTrace parameters so that the exception message and stacktrace are printed when the object can't be created
- returns
an instance of a given class and optionally print message and/or the stacktrace if the class can't be loaded.
- Definition Classes
- Classes
-
def
createObject[T <: AnyRef](className: String, printMessage: Boolean)(implicit m: ClassTag[T]): Option[T]
- returns
an instance of a given class and optionally print message if the class can't be loaded
- Definition Classes
- Classes
-
def
createObject[T <: AnyRef](className: String)(implicit m: ClassTag[T]): Option[T]
- returns
an instance of a given class
- Definition Classes
- Classes
-
def
createSpecification(className: String, printMessage: Boolean, printStackTrace: Boolean): Option[SpecificationStructure]
- returns
a
SpecificationStructure
object from a className if that class is aSpecificationStructure
class.
Tries to load the class name and cast it to a specification None in case of an exception.
- Definition Classes
- SpecificationsFinder
-
def
createSpecification(className: String, verbose: Boolean = false)(implicit args: Arguments): Option[SpecificationStructure]
- returns
a
SpecificationStructure
object from a className if that class is aSpecificationStructure
class.
Tries to load the class name and cast it to a specification None in case of an exception.
- Definition Classes
- SpecificationsFinder
-
def
delete(path: String): Boolean
delete a file
delete a file
- Definition Classes
- FileWriter
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exists(path: String): Boolean
- returns
true if the file exists
- Definition Classes
- FileWriter
-
def
exitSystem(executed: Seq[ExecutedSpecification]): Unit
exit the system with a specific code:
exit the system with a specific code:
- 0 if all the specifications are successful - 1 if there are only failures - 100 if there is any error - 101 if one of them could not even be executed (this is represented by None)
- Definition Classes
- SystemExit
-
def
exitSystem(executed: Option[ExecutedSpecification]): Unit
exit the system for one executed specification (None means that the specification could not be executed)
exit the system for one executed specification (None means that the specification could not be executed)
- Definition Classes
- SystemExit
-
def
exitTheSystem(executed: Seq[Option[ExecutedSpecification]]): Unit
- Attributes
- protected
- Definition Classes
- SystemExit
-
def
exitWith(status: Int): Unit
this method can be overriden for testing
this method can be overriden for testing
- Attributes
- protected
- Definition Classes
- SystemExit
-
def
filePaths(basePath: String = ".", path: String = "*", verbose: Boolean = false): Seq[String]
- path
glob expression, for example:
./dir/**/*.xml
- returns
the list of paths represented by the "glob" definition
path
- Definition Classes
- FileSystem
-
def
filterFiles(found: Seq[File], path: String, verbose: Boolean): Seq[String]
- Definition Classes
- FileSystem
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flush(): Unit
flush the content if necessary
flush the content if necessary
- Definition Classes
- ConsoleOutput → Output
-
def
fromBaseFile(base: File): (File) ⇒ String
- returns
the path of a File relative to a base file
- Definition Classes
- FileReader
-
def
getAbsolutePath(path: String): String
- returns
the file absolute path
- Definition Classes
- FileSystem
-
def
getCanonicalPath(path: String): String
- returns
the file canonical path
- Definition Classes
- FileSystem
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getName(path: String): String
- returns
the file name
- Definition Classes
- FileSystem
-
def
getParent(path: String): String
- returns
the file parent path
- Definition Classes
- FileSystem
-
def
getWriter(path: String, append: Boolean = false): Writer
The getWriter function can be overriden to provide a mock writer writing to the console for example
The getWriter function can be overriden to provide a mock writer writing to the console for example
- returns
a Writer object opened on the file designated by
path
- Definition Classes
- FileWriter
-
def
globToPattern(glob: String): String
- returns
the regular expression equivalent to a glob pattern (see the specs for Fragments)
- Definition Classes
- FileSystem
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
inputStream(filePath: String): InputStream
- returns
a FileInputStream for a given file path
- Definition Classes
- FileReader
-
def
isAbsolute(path: String): Boolean
- returns
true if the file is absolute
- Definition Classes
- FileSystem
-
def
isDir(path: String): Boolean
- returns
true if the File represented by this path is a directory
- Definition Classes
- FileSystem
-
def
isDirectory(path: String): Boolean
- returns
true if the file is a directory
- Definition Classes
- FileSystem
-
def
isFile(path: String): Boolean
- returns
true if the file is a file
- Definition Classes
- FileSystem
-
def
isHidden(path: String): Boolean
- returns
true if the file is hidden
- Definition Classes
- FileSystem
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isVerbose(implicit args: Arguments): Boolean
-
def
listFiles(path: String): List[String]
- returns
the files of that directory
- Definition Classes
- FileSystem
-
def
loadXhtmlFile(filePath: String, report: (Exception, String) ⇒ Unit = defaultLoadXhtmlFileReport, sourceErrors: Boolean = true): NodeSeq
- returns
the xml content of a file using the Xhtml parser if the file contains several nodes, it wraps them up in a single artificial node
- Definition Classes
- FileReader
-
def
loadXmlFile(filePath: String)(report: (Exception) ⇒ Unit = (e:Exception) => e.printStackTrace): NodeSeq
- returns
the xml content of a file, using the XML parser
- Definition Classes
- FileReader
- def main(arguments: Array[String]): Unit
-
def
md5(f: File): String
- returns
the MD5 hash of a file
- Definition Classes
- FileReader
-
def
mkdirs(path: String): Boolean
creates a new directory
creates a new directory
- Definition Classes
- FileWriter
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
packageName(content: String): String
- returns
the package name corresponding to the package declarations at the beginning of a file
- Definition Classes
- SourceFile
-
def
print(m: Any): Unit
print an object with no newline
print an object with no newline
- Definition Classes
- Output
-
def
printStackTrace(t: Throwable): Unit
print stacktraces
print stacktraces
- Definition Classes
- Output
-
def
printf(s: String, args: Any*): Unit
print several objects according to a format string (see Console.printf)
print several objects according to a format string (see Console.printf)
- Definition Classes
- ConsoleOutput → Output
-
def
println(m: Any): Unit
print an object with a newline
print an object with a newline
- Definition Classes
- Output
-
def
readBytes(path: String): Array[Byte]
- returns
the bytes of a file
- Definition Classes
- FileReader
-
def
readFile(path: String): String
reads the content of a file
reads the content of a file
- path
the path of the file to read
- returns
the content of the file at path
- Definition Classes
- FileReader
-
def
readLines(path: String): IndexedSeq[String]
- returns
the lines of a file
- Definition Classes
- FileReader
-
def
removeDir(path: String): String
deletes the directory and all directory content at the specified path and return the parent path of that directory
deletes the directory and all directory content at the specified path and return the parent path of that directory
- Definition Classes
- FileSystem
- def reporter(implicit args: Arguments): DefaultReporter with AllExporting
- def run(arguments: Array[String]): List[ExecutedSpecification]
-
def
samePath(p1: String, p2: String): Boolean
- returns
true if 2 paths are the same according to their canonical representation
- Definition Classes
- FileSystem
-
def
silentLoadXhtmlFileReport: (Exception, String) ⇒ Unit
- Definition Classes
- FileReader
-
def
specPattern(specType: String, pattern: String): String
pattern to use to get specification names from file contents
pattern to use to get specification names from file contents
- Definition Classes
- SpecificationsFinder
-
def
specificationClassNames(implicit args: Arguments): Seq[String]
- returns
the specifications class names to execute
- Attributes
- protected
-
def
specificationNames(path: String = "**/*.scala", pattern: String = ".*Spec", basePath: String = FromSource.srcTestDir, verbose: Boolean = false): Seq[String]
- path
a path to a directory containing scala files (it can be a glob: i.e. "dir/**/*spec.scala")
- pattern
a regular expression which is supposed to match an object name extending a Specification
- returns
specification names by scanning files and trying to find specifications declarations
- Definition Classes
- SpecificationsFinder
-
def
specifications(implicit args: Arguments): Seq[SpecificationStructure]
- returns
the specifications to execute
- Attributes
- protected
-
def
specifications(path: String = "**/*.scala", pattern: String = ".*Spec", filter: (String) ⇒ Boolean = (name: String) => true, basePath: String = FromSource.srcTestDir, verbose: Boolean = false)(implicit args: Arguments = Arguments()): Seq[SpecificationStructure]
- path
a path to a directory containing scala files (it can be a glob: i.e. "dir/**/*spec.scala")
- pattern
a regular expression which is supposed to match an object name extending a Specification
- filter
a function to filter out unwanted specifications
- returns
specifications created from specification names
- Definition Classes
- SpecificationsFinder
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
tryToCreateObject[T <: AnyRef](className: String, printMessage: Boolean = true, printStackTrace: Boolean = true, loader: ClassLoader = ..., parameter: Option[AnyRef] = None)(implicit m: ClassTag[T]): Option[T]
Try to create an instance of a given class by using whatever constructor is available and trying to instantiate the first parameter recursively if there is a parameter for that constructor.
Try to create an instance of a given class by using whatever constructor is available and trying to instantiate the first parameter recursively if there is a parameter for that constructor.
This is useful to instantiate nested classes which are referencing their outer class in their constructor
- Definition Classes
- Classes
-
def
tryToCreateObjectEither[T <: AnyRef](className: String, loader: ClassLoader = ..., parameter: Option[AnyRef] = None)(implicit m: ClassTag[T]): Either[Throwable, T]
Try to create an instance of a given class by using whatever constructor is available and trying to instantiate the first parameter recursively if there is a parameter for that constructor.
Try to create an instance of a given class by using whatever constructor is available and trying to instantiate the first parameter recursively if there is a parameter for that constructor.
This is useful to instantiate nested classes which are referencing their outer class in their constructor
- Definition Classes
- Classes
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
write(path: String)(function: (Writer) ⇒ Unit): Unit
writes some content to a file and take care of closing the file.
writes some content to a file and take care of closing the file.
Usage:
write("./dir/hello.txt") { out => out.write("content") }
- path
path of the file to write
- Definition Classes
- FileWriter
-
def
writeFile(path: String, content: ⇒ String): Unit
writes some content to a file.
writes some content to a file.
- path
path of the file to read
- content
content of the file to write
- Definition Classes
- FileWriter
-
def
writeXmlFile(path: String, content: ⇒ NodeSeq): Unit
writes some xml content to a file.
writes some xml content to a file.
- path
path of the file to read
- content
content of the file to write
- Definition Classes
- FileWriter