scalaprops 项目教程
scalapropsproperty based testing library for Scala项目地址:https://gitcode.com/gh_mirrors/sc/scalaprops
1. 项目的目录结构及介绍
scalaprops 项目的目录结构如下:
scalaprops/
├── build.sbt
├── project/
│ ├── build.properties
│ ├── plugins.sbt
├── src/
│ ├── main/
│ │ ├── scala/
│ │ │ ├── scalaprops/
│ │ │ │ ├── CoArbitrary.scala
│ │ │ │ ├── Gen.scala
│ │ │ │ ├── Cogen.scala
│ │ │ │ ├── ...
│ │ ├── resources/
│ ├── test/
│ │ ├── scala/
│ │ │ ├── scalaprops/
│ │ │ │ ├── TestSuite.scala
│ │ │ │ ├── ...
│ │ ├── resources/
├── .gitignore
├── README.md
├── LICENSE
目录结构介绍
build.sbt
: 项目的构建配置文件。project/
: 包含项目的构建配置和插件配置。build.properties
: 定义了 SBT 的版本。plugins.sbt
: 定义了项目使用的 SBT 插件。
src/
: 包含项目的源代码和资源文件。main/
: 包含项目的核心代码。scala/
: Scala 源代码目录。scalaprops/
: scalaprops 的核心代码。CoArbitrary.scala
: 定义了 CoArbitrary 相关的代码。Gen.scala
: 定义了 Gen 相关的代码。Cogen.scala
: 定义了 Cogen 相关的代码。- ...
resources/
: 包含项目的资源文件。
test/
: 包含项目的测试代码。scala/
: Scala 测试代码目录。scalaprops/
: scalaprops 的测试代码。TestSuite.scala
: 定义了测试套件。- ...
resources/
: 包含测试资源文件。
.gitignore
: 定义了 Git 忽略的文件和目录。README.md
: 项目的介绍文档。LICENSE
: 项目的许可证文件。
2. 项目的启动文件介绍
scalaprops 项目的启动文件主要是 build.sbt
和 project/build.properties
。
build.sbt
build.sbt
是 SBT 项目的构建配置文件,定义了项目的依赖、插件、任务等。以下是一个简单的示例:
name := "scalaprops"
version := "0.9.1"
scalaVersion := "2.13.6"
libraryDependencies ++= Seq(
"com.github.scalaprops" %% "scalaprops" % "0.9.1" % "test",
"com.github.scalaprops" %% "scalaprops-scalaz" % "0.9.1" % "test"
)
testFrameworks += new TestFramework("scalaprops.ScalapropsFramework")
parallelExecution in Test := false // 目前不支持并行执行
project/build.properties
project/build.properties
定义了 SBT 的版本:
sbt.version=1.5.5
3. 项目的配置文件介绍
scalaprops 项目的配置文件主要是 build.sbt
和 project/plugins.sbt
。
build.sbt
build.sbt
中定义了项目的依赖、插件、任务等配置。例如:
name := "scalaprops"
version := "0.9.1"
scalaVersion := "2.13.6"
libraryDependencies ++= Seq(
"com.github.scalaprops" %% "scalaprops" % "0.9.1" % "test",
"com.github.scalaprops" %% "scalaprops-scalaz" % "0.9.1" % "test"
)
testFrameworks += new TestFramework("scalaprops.ScalapropsFramework")
parallelExecution in Test := false // 目前不支持并行执行
project/plugins.sbt
project/plugins.sbt
定义了项目使用的 SBT 插件:
addSbtPlugin("com.github.scalaprops" % "sbt-scalaprops" % "0.9.1")
通过这些配置文件,可以对 scalaprops 项目进行构建、测试和运行。
scalapropsproperty based testing library for Scala项目地址:https://gitcode.com/gh_mirrors/sc/scalaprops