dimakura / sspec Goto Github PK
View Code? Open in Web Editor NEWBehavior Driven Development in Swift
License: MIT License
Behavior Driven Development in Swift
License: MIT License
There's an issue with SSpec.reporter
visibility.
before
function should be run before all examples:
var a = 0
before {
a = 100
}
it {
// modifies a
a = 200
}
it {
print(a) // prints 100
}
Also we need after
function to clean-up data.
We need to spec:
Node
and its subclassesCollectors
and subclassesGlobals are still problem.
Let's hide them behind SSpec
and if we need global function, do it explicitly:
let describe = SSpec.describe
// ...
Another alternative would be to have "test class":
class MyTestClass: SSpecTest {
func test1() {
describe() {
// ...
}
}
}
But it looks too verbose.
After all we'd better use global functions:
describe
which calls SSMatcher.describe
behind the scenescontext
(same as describe
)it
which calls SSMatcher.it
behind the scenesexpect
which calls SSMatcher.expect
behind the scenesThere are a lot of checks we should be performing in order not to stack in some undesirable state:
describe
/context
can be called only when current session is presentit
can be called only within describe
/context
expect
can be called only within it
We will need to monitor type of "currentNode" during initialization and report failures when requirements not met.
The only place we use Node
's level
property is spec reporter.
We actually don't need it: level can be calculated in the reporter itself. Or even inferred from parent hierarchy.
We need release script which can:
Currently we display all running examples with their titles.
We can make alternative reporter which will display green/yellow/red dots for examples.
If we try to compare two arrays, it will fail on compile time:
expect([1, 2]).to.eq([1,2])
// error: generic parameter 'T' could not be inferred
We need to fix this and also introduce new matchers for arrays:
eq
-- for exact matching;includes
-- all elements of the parameter array are included in the matching array;same
-- both arrays have same elements (possibly with different order).Session mode has it's own top-level type.
We should be moving it under Session type.
Running SSpec under XCode.
We can improve error & example descriptions by supporting bold by inserting it in backquotes: `bold`
.
We should be able to run focused tests.
From tester perspective it looks like:
fdescribe("Focused group")
fcontext("Focused context")
fit("Focused example")
Internally Node
should have property focused: Bool = false
, which could be turned to true
with makeFocused()
method.
When we run initialization, we create list of all registered examples. Examples under focused parent are also considered focused.
During test run we skip unfocused examples.
When failed, we need to exit with some error codes.
Try how it works with CIs.
context("some context")
is not visible in the output at all.
Should be displayed as "Skipped" (yellow color).
We need one "runner" for all test functions:
import XCTest
import SSpec
class BDDTests: XCTestCase {
func testBDD() {
SSpec_run {
myTestFunction1()
myTestFunction2()
myTestFunction3()
}
}
static var allTests = [
("testBDD", testBDD),
]
}
Attempt to run two SSpec_run
s should be reported as error.
We should be able to add extensions to SSExpect
from outside packages:
extension SSExpect where T == MyCustomClas {
public var beCPU: Void {
assert(value.isCorrect, // ERROR: value not visible
error: "\(valueStr)") // ERROR: valueStr not visible
}
}
Also:
toString
not visible.negate
variable should be accessible too.Currently there's no error reporting on failures: we just have false
flag for the given run.
The mechanism used should be easily extensible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.