testing
  • Tim

    Tim

    08/26/2022, 12:56 PM
    Mine started doing this recently. If you remove the method=runRemote, it'll run corrctly
  • Tim

    Tim

    08/26/2022, 12:57 PM
    I haven't gotten a chance to figure out what's broken and file a bug yet though
  • richard.herbert

    richard.herbert

    08/26/2022, 1:06 PM
    But surely just calling
    <http://example.com/testbox/tests/specs/BaseTest.cfc|example.com/testbox/tests/specs/BaseTest.cfc>
    just tries to invoke the cfc which will fail?
  • Tim

    Tim

    08/26/2022, 1:07 PM
    oh, sorry. i didn't notice that part.... my links are all to the individual test cfcs
  • Tim

    Tim

    08/26/2022, 1:10 PM
    but yeah, it's the actual cfc's. the runner seems to sort it out.
  • richard.herbert

    richard.herbert

    08/26/2022, 1:15 PM
    I'm not using the
    runner.cfm
    I want to use the
    test-browser
    that lets you move up and down your tests directory to find the actual test cfc you want to run and then it opens a new window just for that cfc which, for me, is showing an empty page
  • Tim

    Tim

    08/26/2022, 1:34 PM
    yeah. that's what I do to. And the cfc is the file in the URL, and if I run that page without
    method=runRemote
    then it runs my tests, and displays the test report.
  • richard.herbert

    richard.herbert

    08/26/2022, 1:42 PM
    Hummm, I'm not sure how that would run? My understanding is that by having your tests extend
    testbox.system.BaseSpec
    it gets access to the
    runRemote
    method which you add to your url, that then handles the processing and presentation of the test results.
  • n

    Niek

    09/06/2022, 4:37 PM
    Hi, I am fairly new to TestBox and Coldbox, but I run into an issue which I don’t understand. I have written a BDD test which tests some Coldbox code. The Coldbox code makes use of a Service. Services need a reinit when you change some code, so every time I run my test, I need the Coldbox application to reinit. The strange thing is, when I run my test on the commandbox cli, a reinit takes place automatically since every change in my Service is visible immediately. However when I run the same test in the browser, a reinit does not take place. I have to do a reinit manually first and then I can run my test in the browser. The URL called from the commandbox CLI is: http://myhost/tests/runner.cfm?&amp;labels=mytest&amp;recurse=true&amp;reporter=json&amp;verbose=false The URL called from the browser is: http://myhost/tests/specs/integration/forms/StoreFormDataTest.cfc?method=runRemote Both run the exact same test, but the first one does a reinit and the second one does not. How can I get the test from the browser to initiate a reinit before running the test?
  • j

    Jim Priest

    09/08/2022, 5:05 PM
    Ohhhh cbPlaywright - this looks interesting 🙂
  • joechastain

    joechastain

    09/19/2022, 11:46 AM
    Good morning. Hope a good weekend was had by all. After a few false starts, I feel like I'm actually and finally building up some momentum with testing. Eric Peterson gave a great presentation on cbPlaywright for end-to-end testing at ITB, which was the match that lit the fuse. I've been spending as much time as I can working on various kinds of testing since then. I have a fairly decent handle on end-to-end tests with cbPlaywright (seriously, what a great tool), and I have a decent-ish (but growing) handle on unit tests and mocking with Testbox. So right now I am working on integration tests with Testbox. I'm trying to test a typical form submission and the associated results on a results page. To pass in all the form fields for my integration tests I'm doing something like
    getRequestContext().setValue( "employeeName", "Joseph Chastain" );
    before the
    execute
    call. I know I can get the rendered results page and check for various things with
    expect( event.getRenderedContent() ).toInclude(  "whatever" );
    But I'm hoping I can get specific values that are calculated in the handler. It looks like I can do this if I stored them in the PRC scope with
    event.getPrivateCollection()
    but I don't typically use the PRC scope. I pass the values to the results view via the
    args
    param in the
    event.setView()
    call in the handler. Is there a way to get the values in the args param in the test? Or do I need to start using the PRC scope if I want to do this? I checked the docs but, if there is anything, I didn't see it. Appreciate any insights on this. Thanks.
  • joechastain

    joechastain

    09/30/2022, 2:23 PM
    Happy Friday all. How does everyone handle their tests as far as version control is concerned? Same repo as the code or a separate repo? If the same, what's the best way to keep the tests out of production? The best I've come up with so far is adding something to our deployment script to just remove the tests directory in prod.
  • aliaspooryorik

    aliaspooryorik

    10/03/2022, 11:41 AM
    Is there a testbox header that is the failures + errors count? Using AWS CodeBuild (which does a curl to the CFM runner) and have to check both currently. Or should I be looking at something else instead of the
    x-testbox-totalError
    and
    x-testbox-totalFail
    ?
  • Adam Cameron

    Adam Cameron

    10/05/2022, 10:27 PM
    Just in case yer interested in testing outside of CFML:https://blog.adamcameron.me/2022/10/data-driven-tests-in-junit-and-kotest.html
  • Adam Cameron

    Adam Cameron

    10/09/2022, 2:48 PM
    It's Kotlin rather than CFML, but the concepts and the techniques are the same, so I figured it's worth sharing:https://blog.adamcameron.me/2022/10/kotlin-tdd-writing-tests-for-small-web.html
  • Tim

    Tim

    10/12/2022, 1:52 PM
    Is there a way to override the mockbox stub directory universally, via Application.cfc or something? I see that I can do it within an individual test via
    getMockBox()
    . But I don't see a single location that would affect all of my tests.
  • l

    lmajano

    10/12/2022, 8:16 PM
    hmm, good point
  • l

    lmajano

    10/12/2022, 8:16 PM
    I don’t think there is
  • l

    lmajano

    10/12/2022, 8:17 PM
    but we can do a setting somewhere
  • l

    lmajano

    10/12/2022, 8:17 PM
    good point
  • l

    lmajano

    10/12/2022, 8:17 PM
    maybe when isntantiating testbox
  • James Balaguer

    James Balaguer

    10/18/2022, 9:50 PM
    Using Testbox is ok to use
    expect()
    without using
    describe
    and
    it
    ? meaning just like an assert():
    function testExpectationExamples () {
    		var message = "A custom message can be prepended to the error message!";
    
    		// toBe( expected, [message] ) : Assert something is equal to each other, no case is required
    		var value = "myValue";
    		expect(value).toBe("myvalue", message);
    		expect(value).toBe("myValue", message);
    		expect(value).toBe("MYVALUE", message);
    }
  • gpickin

    gpickin

    10/19/2022, 9:30 PM
    Anyone using testbox, you might like something I've been working on, a shareable bunch of tools, allows me to do things like this. New matchers, new helpers, easy to add into testbox, but saves lots of code, lots more readable, way more readable messages when tests do not pass. @Adam Cameron might have given me an idea or two 😉
    var oResponse = deserializeJSON( event.getRenderedContent() );
    expect( oResponse ).toBeStruct()
        .toHaveKeyWithCase( "error" )
        .toHaveKeyWithCase( "messages" );
    expect( oResponse.error ).toBeFalse();                        
    expect( oResponse.messages )
        .toBeArray()
        .toHaveLengthGTE( 1 );
        expect( oResponse.messages[1] ).toBe( "postPandaDocWebhookRecipientCompletedADocument Interception point announced" );
    to
    expect( event ).toHaveAPISuccessWithMessage(    "postPandaDocWebhookRecipientCompletedADocument Interception point announced" );
  • Adam Cameron

    Adam Cameron

    10/20/2022, 9:54 AM
    Yeah implementing one's own bespoke matchers is something ppl should always consider if it can give a name to a commonly-used expectation. The second version there is much clearer as to what the expectation is.
  • Adam Cameron

    Adam Cameron

    10/20/2022, 9:55 AM
    I have to admit it's not something I have done. And I ought to have.
  • zackster

    zackster

    10/26/2022, 10:34 AM
    guess it's slightly OT, but which testing framework do people use for their javascript side of their cfml apps?
  • joechastain

    joechastain

    10/26/2022, 11:34 AM
    I believe I found a bug in cbplaywright v1.0.2 for ACF (I'm using ACF 2021.0.05). When I use the
    route
    helper function, I get an error message that states
    Variable STRUCTVALUEARRAY is undefined
    in
    cbPlaywright\models\PlaywrightMixins.cfm
    on line 73. That line is
    var pathArray = structValueArray( arguments );
    structValueArray
    is not a function in ACF.
  • j

    Jim Priest

    11/04/2022, 3:07 PM
    This looks like an interesting testing ide tool from JetBrains - seems like it's combining the browser, db and code ide all in one... https://www.jetbrains.com/aqua/
  • zackster

    zackster

    12/07/2022, 5:56 PM
    anyone know of a tool to compare junit test results, lucee's build outputs them, I'd like to be able to compare runs