Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.

Commit

Permalink
Use TestService, update README to document usage, return results from…
Browse files Browse the repository at this point in the history
… TestBootstrap:Run
  • Loading branch information
LPGhatguy committed Nov 2, 2017
1 parent d1c8434 commit 2e95eb4
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/luacov.*
/testez-installer.lua
14 changes: 14 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
stds.roblox = {
globals = {
"game"
},
read_globals = {
-- Roblox globals
"script",

-- -- Extra functions
"tick", "warn",
}
}

std = "lua51+roblox"
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
todo
# Contributing to TestEZ
TODO
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# TestEZ
TestEZ is a testing framework targeted at Roblox Lua.
<h1 align="center">TestEZ</h1>
<div align="center">
<!-- TODO: badges and stuff here -->
</div>

<div align="center">
BDD-style Roblox Lua testing framework
</div>

<div>&nbsp;</div>

TestEZ can run within Roblox itself, as well as inside [Lemur](https://github.com/LPGhatguy/Lemur) for testing on CI systems.

## Usage

### Method 1: Installation Script (Roblox)
* Download the latest release from the [GitHub releases page](https://github.com/Roblox/TestEZ/releases).
* Use the 'Run Script' menu (located in the Test tab) to locate and run this script.
* Follow the instructions in the installer

This installation script is generated by a tool called [rbxpacker](https://github.com/LPGhatguy/rbxpacker).

### Method 2: Filesystem (Roblox)
If building a Roblox place by importing scripts from the filesystem, copy the `lib` directory into your project and use a plugin like [rbxfs](https://github.com/LPGhatguy/rbxfs) to synchronize the filesystem into a Roblox place.

### Method 3: Lemur (CI Systems)
You can use [Lemur](https://github.com/LPGhatguy/Lemur) paired together with a regular Lua 5.1 interpreter to run tests written with TestEZ.

This is the best approach when testing Roblox Lua libraries using existing continuous integration systems like Travis-CI. We use this technique to run tests for [Rodux](https://github.com/Roblox/Rodux).

## License
TestEZ is available under the [todo] license. See [LICENSE.md](LICENSE.md) for details.
3 changes: 3 additions & 0 deletions build-installer
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

rbxpacker --exclude **/*.spec.lua --folder TestEZ --name TestEZ lib > testez-installer.lua
6 changes: 4 additions & 2 deletions lib/Reporters/TextReporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
standard output and TestService.
]]

local TestService = game:GetService("TestService")

local TestEnum = require(script.Parent.Parent.TestEnum)

local INDENT = (" "):rep(3)
Expand Down Expand Up @@ -84,10 +86,10 @@ function TextReporter.report(results)

if #results.errors > 0 then
print("Errors reported by tests:")
print("")

for _, message in ipairs(results.errors) do
-- game:GetService("TestService"):Error(message)
print(message)
game:GetService("TestService"):Error(message)

-- Insert a blank line after each error
print("")
Expand Down
2 changes: 2 additions & 0 deletions lib/TestBootstrap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ function TestBootstrap:run(root, reporter, showTimingInfo)

print(table.concat(timing, "\n"))
end

return results
end

return TestBootstrap

0 comments on commit 2e95eb4

Please sign in to comment.