You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Josh Tynjala <jo...@apache.org> on 2019/03/15 17:43:29 UTC

RoyaleUnit

Hey everyone,

You may have noticed that I committed a new RoyaleUnit library to royale-asjs yesterday. It is a unit testing library, similar to (and greatly inspired by) FlexUnit. It is an upgrade to the barebones "Testing" library that was based on my work from a while back. I brought a number of things more in line with FlexUnit's API.

* RoyaleUnit runs in web browsers, Node.js, and in the Flash runtimes.
* For basic tests, in addition to the existing [Test], [Before], and [After] metadata that we already had, I also added [Ignore], [BeforeClass], and [AfterClass].
* I also added [Suite] and [RunWith] metadata to run suites of tests.
* I added a CIListener, similar to FlexUnit's, that supports connecting to the socket server that FlexUnit's Ant task creates. Currently, CIListener only works in the Flash runtimes. In other environments, you can use TraceListener() and the results will be printed to the console with trace(). There's also a FailureListener that may be useful. For instance, in Node.js or AIR, you might use it to quit with different exit codes.

As part of this process, I also updated the existing tests that we run when building the Core and Basic libraries. It basically involved updating the [RunWith] metadata with a new class, and switching the app startup to use RoyaleUnitCore instead of FlexUnitCore. As I mentioned above, we can still use FlexUnit's Ant task for SWFs, and I confirmed that this is working correctly in the Ant build scripts.

I can probably get the CIListener working in Node.js too, since it natively supports sockets. However, web browsers don't support raw TCP sockets in JS. Browsers have WebSockets, which are similar, but not exactly the same. WebSockets require a special handshake to initialize the connection that requires the server to support it. With that in mind, FlexUnit's Ant task does not support WebSockets. However, it may be possible to fork/update it to add that handshake.

I'm sorry if I broke anything for anyone that was using the existing Testing library. However, it's pretty easy to upgrade to RoyaleUnit. If you need some example code, take a look at the tests for the Core library:

https://github.com/apache/royale-asjs/tree/develop/frameworks/projects/Core/src/test/royale

If you need any help upgrading to RoyaleUnit, please let me know, and I'll be happy to help!

- Josh

Re: RoyaleUnit

Posted by Andrew Wetmore <co...@gmail.com>.
Yes! This will need some attention in the help docs, too...

On Sat, Mar 16, 2019 at 6:33 AM Carlos Rovira <ca...@apache.org>
wrote:

> Hi Josh,
>
> Awesome news! Thanks for doing this. Maybe could I suggest to put all this
> info in the GitHub wiki so we have all available in a more convenient site?
> I'll tweet about this since it deserves to be shared! :)
>
> Thanks!
>
> El vie., 15 mar. 2019 a las 20:02, Josh Tynjala (<jo...@apache.org>)
> escribió:
>
> > By the way, I should mention that it's possible to use RoyaleUnit in pure
> > ActionScript projects compiled with Royale too. Here's an example where
> the
> > tests that RoyaleUnit runs on itself are executed in Node.js:
> >
> >
> >
> https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/RoyaleUnit/src/test/royale/NodeTests.as
> >
> > In pure ActionScript projects, you may need to add a few SWC files from
> > Royale to your compiler options. Here's the asconfig.json file for Visual
> > Studio Code that I used to configure my Node.js project to use
> RoyaleUnit.
> > It should be pretty similar for browser projects.
> >
> >
> >
> https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/RoyaleUnit/src/test/royale/asconfig.json
> >
> > - Josh
> >
> > On 2019/03/15 17:43:29, Josh Tynjala <jo...@apache.org> wrote:
> > > Hey everyone,
> > >
> > > You may have noticed that I committed a new RoyaleUnit library to
> > royale-asjs yesterday. It is a unit testing library, similar to (and
> > greatly inspired by) FlexUnit. It is an upgrade to the barebones
> "Testing"
> > library that was based on my work from a while back. I brought a number
> of
> > things more in line with FlexUnit's API.
> > >
> > > * RoyaleUnit runs in web browsers, Node.js, and in the Flash runtimes.
> > > * For basic tests, in addition to the existing [Test], [Before], and
> > [After] metadata that we already had, I also added [Ignore],
> [BeforeClass],
> > and [AfterClass].
> > > * I also added [Suite] and [RunWith] metadata to run suites of tests.
> > > * I added a CIListener, similar to FlexUnit's, that supports connecting
> > to the socket server that FlexUnit's Ant task creates. Currently,
> > CIListener only works in the Flash runtimes. In other environments, you
> can
> > use TraceListener() and the results will be printed to the console with
> > trace(). There's also a FailureListener that may be useful. For instance,
> > in Node.js or AIR, you might use it to quit with different exit codes.
> > >
> > > As part of this process, I also updated the existing tests that we run
> > when building the Core and Basic libraries. It basically involved
> updating
> > the [RunWith] metadata with a new class, and switching the app startup to
> > use RoyaleUnitCore instead of FlexUnitCore. As I mentioned above, we can
> > still use FlexUnit's Ant task for SWFs, and I confirmed that this is
> > working correctly in the Ant build scripts.
> > >
> > > I can probably get the CIListener working in Node.js too, since it
> > natively supports sockets. However, web browsers don't support raw TCP
> > sockets in JS. Browsers have WebSockets, which are similar, but not
> exactly
> > the same. WebSockets require a special handshake to initialize the
> > connection that requires the server to support it. With that in mind,
> > FlexUnit's Ant task does not support WebSockets. However, it may be
> > possible to fork/update it to add that handshake.
> > >
> > > I'm sorry if I broke anything for anyone that was using the existing
> > Testing library. However, it's pretty easy to upgrade to RoyaleUnit. If
> you
> > need some example code, take a look at the tests for the Core library:
> > >
> > >
> >
> https://github.com/apache/royale-asjs/tree/develop/frameworks/projects/Core/src/test/royale
> > >
> > > If you need any help upgrading to RoyaleUnit, please let me know, and
> > I'll be happy to help!
> > >
> > > - Josh
> > >
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>


-- 
Andrew Wetmore

http://cottage14.blogspot.com/

Re: RoyaleUnit

Posted by Carlos Rovira <ca...@apache.org>.
Hi Josh,

Awesome news! Thanks for doing this. Maybe could I suggest to put all this
info in the GitHub wiki so we have all available in a more convenient site?
I'll tweet about this since it deserves to be shared! :)

Thanks!

El vie., 15 mar. 2019 a las 20:02, Josh Tynjala (<jo...@apache.org>)
escribió:

> By the way, I should mention that it's possible to use RoyaleUnit in pure
> ActionScript projects compiled with Royale too. Here's an example where the
> tests that RoyaleUnit runs on itself are executed in Node.js:
>
>
> https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/RoyaleUnit/src/test/royale/NodeTests.as
>
> In pure ActionScript projects, you may need to add a few SWC files from
> Royale to your compiler options. Here's the asconfig.json file for Visual
> Studio Code that I used to configure my Node.js project to use RoyaleUnit.
> It should be pretty similar for browser projects.
>
>
> https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/RoyaleUnit/src/test/royale/asconfig.json
>
> - Josh
>
> On 2019/03/15 17:43:29, Josh Tynjala <jo...@apache.org> wrote:
> > Hey everyone,
> >
> > You may have noticed that I committed a new RoyaleUnit library to
> royale-asjs yesterday. It is a unit testing library, similar to (and
> greatly inspired by) FlexUnit. It is an upgrade to the barebones "Testing"
> library that was based on my work from a while back. I brought a number of
> things more in line with FlexUnit's API.
> >
> > * RoyaleUnit runs in web browsers, Node.js, and in the Flash runtimes.
> > * For basic tests, in addition to the existing [Test], [Before], and
> [After] metadata that we already had, I also added [Ignore], [BeforeClass],
> and [AfterClass].
> > * I also added [Suite] and [RunWith] metadata to run suites of tests.
> > * I added a CIListener, similar to FlexUnit's, that supports connecting
> to the socket server that FlexUnit's Ant task creates. Currently,
> CIListener only works in the Flash runtimes. In other environments, you can
> use TraceListener() and the results will be printed to the console with
> trace(). There's also a FailureListener that may be useful. For instance,
> in Node.js or AIR, you might use it to quit with different exit codes.
> >
> > As part of this process, I also updated the existing tests that we run
> when building the Core and Basic libraries. It basically involved updating
> the [RunWith] metadata with a new class, and switching the app startup to
> use RoyaleUnitCore instead of FlexUnitCore. As I mentioned above, we can
> still use FlexUnit's Ant task for SWFs, and I confirmed that this is
> working correctly in the Ant build scripts.
> >
> > I can probably get the CIListener working in Node.js too, since it
> natively supports sockets. However, web browsers don't support raw TCP
> sockets in JS. Browsers have WebSockets, which are similar, but not exactly
> the same. WebSockets require a special handshake to initialize the
> connection that requires the server to support it. With that in mind,
> FlexUnit's Ant task does not support WebSockets. However, it may be
> possible to fork/update it to add that handshake.
> >
> > I'm sorry if I broke anything for anyone that was using the existing
> Testing library. However, it's pretty easy to upgrade to RoyaleUnit. If you
> need some example code, take a look at the tests for the Core library:
> >
> >
> https://github.com/apache/royale-asjs/tree/develop/frameworks/projects/Core/src/test/royale
> >
> > If you need any help upgrading to RoyaleUnit, please let me know, and
> I'll be happy to help!
> >
> > - Josh
> >
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Re: RoyaleUnit

Posted by Josh Tynjala <jo...@apache.org>.
By the way, I should mention that it's possible to use RoyaleUnit in pure ActionScript projects compiled with Royale too. Here's an example where the tests that RoyaleUnit runs on itself are executed in Node.js:

https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/RoyaleUnit/src/test/royale/NodeTests.as

In pure ActionScript projects, you may need to add a few SWC files from Royale to your compiler options. Here's the asconfig.json file for Visual Studio Code that I used to configure my Node.js project to use RoyaleUnit. It should be pretty similar for browser projects.

https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/RoyaleUnit/src/test/royale/asconfig.json

- Josh

On 2019/03/15 17:43:29, Josh Tynjala <jo...@apache.org> wrote: 
> Hey everyone,
> 
> You may have noticed that I committed a new RoyaleUnit library to royale-asjs yesterday. It is a unit testing library, similar to (and greatly inspired by) FlexUnit. It is an upgrade to the barebones "Testing" library that was based on my work from a while back. I brought a number of things more in line with FlexUnit's API.
> 
> * RoyaleUnit runs in web browsers, Node.js, and in the Flash runtimes.
> * For basic tests, in addition to the existing [Test], [Before], and [After] metadata that we already had, I also added [Ignore], [BeforeClass], and [AfterClass].
> * I also added [Suite] and [RunWith] metadata to run suites of tests.
> * I added a CIListener, similar to FlexUnit's, that supports connecting to the socket server that FlexUnit's Ant task creates. Currently, CIListener only works in the Flash runtimes. In other environments, you can use TraceListener() and the results will be printed to the console with trace(). There's also a FailureListener that may be useful. For instance, in Node.js or AIR, you might use it to quit with different exit codes.
> 
> As part of this process, I also updated the existing tests that we run when building the Core and Basic libraries. It basically involved updating the [RunWith] metadata with a new class, and switching the app startup to use RoyaleUnitCore instead of FlexUnitCore. As I mentioned above, we can still use FlexUnit's Ant task for SWFs, and I confirmed that this is working correctly in the Ant build scripts.
> 
> I can probably get the CIListener working in Node.js too, since it natively supports sockets. However, web browsers don't support raw TCP sockets in JS. Browsers have WebSockets, which are similar, but not exactly the same. WebSockets require a special handshake to initialize the connection that requires the server to support it. With that in mind, FlexUnit's Ant task does not support WebSockets. However, it may be possible to fork/update it to add that handshake.
> 
> I'm sorry if I broke anything for anyone that was using the existing Testing library. However, it's pretty easy to upgrade to RoyaleUnit. If you need some example code, take a look at the tests for the Core library:
> 
> https://github.com/apache/royale-asjs/tree/develop/frameworks/projects/Core/src/test/royale
> 
> If you need any help upgrading to RoyaleUnit, please let me know, and I'll be happy to help!
> 
> - Josh
> 

Re: RoyaleUnit

Posted by Kenny Lerma <ke...@kennylerma.com>.
This is very interesting Josh.  Currently, for Spriteflexjs, I'm using
Jasmine since that's what was available for Royale.  I'll have to look at
RoyaleUnit and see if it works for me.

Thanks for your hard work.

Kenny

On Fri, Mar 15, 2019 at 12:43 PM Josh Tynjala <jo...@apache.org>
wrote:

> Hey everyone,
>
> You may have noticed that I committed a new RoyaleUnit library to
> royale-asjs yesterday. It is a unit testing library, similar to (and
> greatly inspired by) FlexUnit. It is an upgrade to the barebones "Testing"
> library that was based on my work from a while back. I brought a number of
> things more in line with FlexUnit's API.
>
> * RoyaleUnit runs in web browsers, Node.js, and in the Flash runtimes.
> * For basic tests, in addition to the existing [Test], [Before], and
> [After] metadata that we already had, I also added [Ignore], [BeforeClass],
> and [AfterClass].
> * I also added [Suite] and [RunWith] metadata to run suites of tests.
> * I added a CIListener, similar to FlexUnit's, that supports connecting to
> the socket server that FlexUnit's Ant task creates. Currently, CIListener
> only works in the Flash runtimes. In other environments, you can use
> TraceListener() and the results will be printed to the console with
> trace(). There's also a FailureListener that may be useful. For instance,
> in Node.js or AIR, you might use it to quit with different exit codes.
>
> As part of this process, I also updated the existing tests that we run
> when building the Core and Basic libraries. It basically involved updating
> the [RunWith] metadata with a new class, and switching the app startup to
> use RoyaleUnitCore instead of FlexUnitCore. As I mentioned above, we can
> still use FlexUnit's Ant task for SWFs, and I confirmed that this is
> working correctly in the Ant build scripts.
>
> I can probably get the CIListener working in Node.js too, since it
> natively supports sockets. However, web browsers don't support raw TCP
> sockets in JS. Browsers have WebSockets, which are similar, but not exactly
> the same. WebSockets require a special handshake to initialize the
> connection that requires the server to support it. With that in mind,
> FlexUnit's Ant task does not support WebSockets. However, it may be
> possible to fork/update it to add that handshake.
>
> I'm sorry if I broke anything for anyone that was using the existing
> Testing library. However, it's pretty easy to upgrade to RoyaleUnit. If you
> need some example code, take a look at the tests for the Core library:
>
>
> https://github.com/apache/royale-asjs/tree/develop/frameworks/projects/Core/src/test/royale
>
> If you need any help upgrading to RoyaleUnit, please let me know, and I'll
> be happy to help!
>
> - Josh
>