-
Notifications
You must be signed in to change notification settings - Fork 95
Automated Tests
Our automated testing suite uses sbt
and the Scala Test FunSuite, just like the NetLogo/NetLogo project. These tests ensure each Models Library model is following our style guide, correctly compiles in the newest version of NetLogo, and more.
If you want to update the version of NetLogo that the models are run against, you can change the BinTray dependency (go there and find the latest posted version of netlogo/NetLogo-JVM/netlogo) here.
As of e35ce19, the below testing suites are run:
- NLWTests
- All primitives are supported by NLW (only run if
org.nlogo.onLocal
is set due to false positives)
- SpellCheckTests
- Models must not contain typos
- InfoTabUrlTests
- URLs used in info tabs should be valid (only run if
org.nlogo.onLocal
is set due to false positives)
- PreviewImagesTests
- Models should have manual previews only if needed or permitted
- Models should have committed preview iif they're 3d or require manual preview
- Images should be in
.gitignore
iif they don't need manual previews - .gitignore should not have duplicates
- .gitignore should not contain preview entries for non-existing models
- ButtonTests:
- Buttons should be disabled until ticks start if they trigger a runtime error
- If any button is disabled until ticks start, ensure at least one enabled button that resets ticks
- BehaviorSpaceTests:
- BehaviorSpace experiment names should not start with "experiment"
- NameTests:
- There should be no duplicate model names
- BadInterfacesTests:
- Widget sections should have proper lengths
- Output widgets should have reasonably sized font
- Textboxes (i.e., notes) should be wide enough
- InfoTabsTests:
- All models' info tabs should have WHAT IS IT? section
- Most info tabs should start with WHAT IS IT? section
- Length of first paragraph of WHAT IS IT should be >= 40 and <= 700
- First paragraph of WHAT IS IT should be unique
- Info tabs should not have empty sections
- Info tabs should not have repeated sections
- Bullet list using dashes should have space after dash
- Info tabs should not contain reviewer comments (e.g.
{{{
or}}}
) - Info tabs should not contain HTML tags (other than
<sup>
and<sub>
) - Code blocks should only include NetLogo code
- UpdateModeTests:
- Models should use tick-based updates unless otherwise specified
- LegalInformationTests:
- The last line of the info tab should be a well-formatted legal snippet inside an HTML comment
- The notarizer should work properly on all models
- Model file should be identical to output of Notarizer
- ModelFileTests:
- Models should not use tab characters anywhere
- Models should not countain trailing whitespace
- CrossReferenceTests:
- all cross-referenced single models exist
- all cross-referenced directories exist and are directories
- ModelCompilationTests:
- Compilation output should satisfy various properties
- VersionTests:
- All models are readable
- Version should be one of NetLogo 6.1.1
- ViewTests:
- Models should have integer patch sizes
- Most models should have a frame rate of 30
- Saved view size must match size computed from the saved patch size and screen-edge-x/y
- MergeConflictTests:
- No merge conflicts appear in model files
- CodeTests:
- Forbidden primitives are not used
- Plot names should be case insensitive
- Plot-pen names should be case insensitive
- All identifiers should be lowercase
- Plotting commands should not be in the main code
- Lines should not be longer than 170 characters
- Anonymous procedures with zero or one argument should not use brackets
- Code should not contain reviewer comments (e.g.
{{{
or}}}
)
This is a total of 18 testing suites (only 16 of which are run by default).
As of writing this guide, the Models Library tests do support the Liberica Open (full) JDK 8. Note, you must have the full version because of JavaFX dependencies.
NetLogo uses Java 8 (JDK 1.8), sbt
, and aspell
(for spell checking). The easiest way to get things up and running on Mac is to first install Homebrew.
To setup your environment:
- To install
sbt
:brew install sbt
- To install JDK 1.8, you can use OpenJDK:
-
brew tap bell-sw/liberica
- tellbrew
to track the Liberica releases -
brew install --cask liberica-jdk8-full
- Installs the JDK8 including JavaFX libs from Liberica (u275
) -
export JAVA_HOME=/Library/Java/JavaVirtualMachines/liberica-jdk-8-full.jdk/Contents/Home
(set the desired Java version forsbt
) (Note: you can also set this in zsh/bash profile by doing something along the lines ofecho 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/liberica-jdk-8-full.jdk/Contents/Home' >> ~/.zshrc
-
- To install
aspell
:brew install aspell
To setup the Models Library:
-
git clone https://github.com/NetLogo/models.git
- grab the latest copy of the models library from GitHub -
cd models
- change the working directory to the library's main folder -
sbt
- start the build tool
And now you should be off to the races!
sbt test
sbt -Dorg.nlogo.is3d=true
As of f9ab7c5, this is accomplished similarly to how we run 3D models tests:
sbt -Dorg.nlogo.onLocal=true
sbt -Dorg.nlogo.onLocal=true -Dorg.nlogo.is3d=true
As of dede07c, we've switched to GitHub Actions for our online builds.
When you publish a branch on the NetLogo/models repo, that will also automatically trigger a build on GitHub Actions. While there is a NetLogo build server, Jenkins, the Models Library is no longer hosted there due to it really not being necessary.
Models Library Editing
- Changes Since Previous Release
- Reviewing a Model for the Library
- Template Letter for Requesting a Review of a Model
- Automated Tests
- Resaving Models in the Newest Release
- Copyright and Citation Info
- Models Cross Referencing
- Models Library Statistics
- What is a Code Example?
- What is a Curricular Model?