lmajano
07/27/2023, 4:26 PMbe.
Welcome to the world of TestBox Modules!! Hierarchical Modules for Testing Pleasures: https://ortussolutions.atlassian.net/browse/TESTBOX-377
Please try it out and let me know how we can improve it!lmajano
08/01/2023, 10:36 AMaliaspooryorik
richard.herbert
08/09/2023, 4:40 PM/tests
now respond with...tony
12/07/2023, 9:09 PMDirk
01/30/2024, 10:59 AMAdam Brunt
02/07/2024, 6:01 PMTim Garver
02/15/2024, 6:12 PMTim Garver
02/15/2024, 6:30 PMTim
05/01/2024, 9:49 PMvar testValue = '{abc:"def"}';
var actualValue = myComponent.getFormattedText(testValue);
expect(actualValue).toInclude(EncodeForXML(testValue));
And that's "failing" because
The needle [{abc:"def"}] was not found in [<?xml version="1.0" encoding="UTF-8"?><record><datum key="id">{abc:"def"}</datum></record>I think it's worth noting that getFormattedText also runs testValue through EncodeForXML under the hood. So it's especially a mystery to me why it comes out nice on one side, but not on the other. Why is EncodeForXML feeling a need to encode the braces and quotes in one string, but not the other, causing them to not match?
Dave Merrill
05/11/2024, 11:29 AMBrent
05/21/2024, 3:50 PMchris-schmitz
06/03/2024, 12:00 PMonSpecEnd()
, I tested the method by calling it directly and the file was created as expected. I then went on and passed the listener CFC to testbox: testbox.run( callbacks=myLstener )
, but, it seems in this case onSpecEnd()
is not executed.
So maybe I am misunderstanding the concept and purpose of listeners? Unfortunately the Testbox docs don't say much about it, can somebody please tell me where to find more information or how to tackle my initial problem (tests sometimes failing, sometimes passing)? Thank you!Brent
06/11/2024, 9:15 PMAndras Nagy
06/20/2024, 5:30 AMFunction 'getComponentMetadata' not found
error for a lot of things I'm doing so this might be a generic error.
private function runTests() {
var javaSystem = createObject( "java", "java.lang.System" );
var exerciseRoot = javaSystem.getProperty( "user.dir" );
var testCFC = ArrayFirst( DirectoryList( path = exerciseRoot, filter = "*Test.cfc" ) );
var testRunner = new testbox.system.TestBox( testCFC );
var testData = testRunner.runRaw().getMemento();
println( testData );
// Set proper exit code
if( testData.totalFail || testData.totalError ) {
setExitCode( 1 );
}
}
Brent
06/24/2024, 11:20 PMbeforeAll()
to instantiate the component. My question is what is recommended for initializing an environment (populating and setting up needed global settings. i.e. found in Application.cfc) in the tests?
Example:
component extends="testbox.system.BaseSpec" {
function beforeAll(){
// I could setup things like this, but is there a better way?
application.dsn = "myDsn";
// Is there a way to reference what is set in Application.cfc - Can I just reuse what is already set in Application.cfc? (there are a lot of global vars set...)
// should I replicate Application.cfc var settings in the tests/Application.cfc (this feels wrong and maintenance problem prone)
// instantiate my component with necessary dependencies injected
myComponent = createObject('component', 'some.cool.Component').init(
dsn=application.dsn,
someKey=application.someKey,
otherInjectedComponent=application.instantiatedOtherComponent,
//etc....
)
}
function afterAll(){
// Do I need to do anything here?
}
describe("component tests", function() {
it("can compile", function() {
// referencing the component instance I created in beforeAll
expect(myComponent).toBeComponent();
});
});
}
Brent
06/26/2024, 1:40 AMsuper.beforeAll()
or super.afterAll()
in test bundles referenced in documentation and examples I'm reading that inherit from a Base Test Class (that inherits from the Testbox Base Spec).
Can someone explain to me what this means:
"This also helps parent classes enforce their setup methods are called by annotating the methods with @beforeAll
. No more forgetting to call super.beforeAll()
!"
- from this page: https://testbox.ortusbooks.com/in-depth/life-cycle-methods/annotations
I am not doing this (not calling super.beforeAll etc, anywhere), but my tests are working fine. Am I missing something or should I be calling that somewhere? When and where do you need to call the super.[LifeCycleMethods]()
?
My class inheritance:
testbox.system.BaseSpec
-> myBaseTestClass (initializes application variables/test setup and does not call super.beforeEach etc.)Brent
07/02/2024, 8:39 PMsetSomeProp()
method that exists on it?Brent
07/03/2024, 5:01 PMmockBox.createStub(extends="path.to.my.s3service");
That will create a fake S3 service that mirrors the interface etc of my service but not actually do anything, right?
Do I need to call init() on that as well to instantiate it?Brent
07/03/2024, 8:19 PMAdam Cameron
Brent
07/30/2024, 2:19 AM.$("myprivatemethod", "return this")
seancorfield
lmajano
09/10/2024, 9:48 PMNew Feature
TESTBOX-391 MockBox converted to script
TESTBOX-392 BoxLang classes support
TESTBOX-393 New environment helpers to do skip detections or anything you see fit: isAdobe, isLucee, isBoxLang, isWindows, isMac, isLinux
TESTBOX-394 new `test(), xtest(), ftest()` alias for more natuarl testing
TESTBOX-397 debug() get's two new arguments: label and showUDFs
TESTBOX-398 DisplayName on a bundle now shows up in the reports
TESTBOX-399 xUnit new annotation for @DisplayName so it can show instead of the function name
Improvement
TESTBOX-289 showUDFs = false option with debug()
TESTBOX-331 TextReporter doesn't correctly support testBundles URL param
TESTBOX-395 adding missing focused argument to spec methods
TESTBOX-396 Generating a repeatable id for specs to track them better in future UIs
Bug
TESTBOX-123 If test spec descriptor contains a comma, it can not be drilled down to run that one spec directly
TESTBOX-338 describe handler in non-called test classes being executed
lmajano
09/13/2024, 3:17 PM--verbose
flag and it will stream back to you the progress of the executions of your tests, bundles and suites.
Here are the docs: https://testbox.ortusbooks.com/getting-started/running-tests/boxlang-runner
I would love some testing of this new feature. Just install testbox@be
and use the ./testbox/bin/run
scriptspills
09/14/2024, 6:03 PMlmajano
09/27/2024, 4:18 PMlmajano
09/27/2024, 4:25 PMlmajano
01/28/2025, 5:20 PMlmajano
03/31/2025, 3:01 PM