GithubHelp home page GithubHelp logo

peoplesoft-psunit's Introduction

PSUnit - Unit test framework for PeopleSoft

Disclaimer

PSUnit is taken directly from Oracle, with a few modifications. You used to be able to get the the original PSUnit project from the download link on the Oracle Blog, but it has since disappeared (404) in all of the places I have looked for it.

The copyright for PSUnit is (probably) held by Jim Marion/David Bain of Oracle, although that was years ago, so it might have changed since then. Regardless, there was not an explicit copyright stated, so I want to re-iterate that this is not my own work, but it didn't exist in Github, so I wanted to showcase it there so that you could browse the source code and download the project xml. In the blog about its release, it is specified as "open source," which probably means using it is safe. ๐Ÿ˜Š

About PSUnit

PSUnit is a PeopleSoft testing framework that is patterned after xUnit. It is intended to be a help for Test-Driven-Design, or TDD, which essentially means writing the tests before the code to ensure that your code is testable. Making testable code is always a good goal, because then a unit test (like PSUnit) can be run which will verify in a small amount of time that your code is likely working.

As mentioned before, PSUnit used to be an internal thing for PeopleSoft, but it appears to now be open source. To find out more information about PSUnit, you can go to the blog post about it, or the Introduction document by Jim Marion.

Modifications

I have written a new BaseTest class, which slightly modifies the way that unit tests are run. This can be found under Y_TEST:BaseTest. The delivered code can all be found under TTS_UNITTEST. The custom modifications include the ability to count the number of assertions that were made, as well as a couple of additional methods that I thought might be helpful for test purposes. I have also modified a handful of the methods to take different actions that I thought were helpful.

Also included is a method that will allow you to run all of the tests in your test class automatically. For this to work, all of the desired test methods must start with test, have no parameters, and be declared as public or protected in the class. The BaseTest class will run all of the tests it can find.

Usage

To get PSUnit working in your PeopleSoft environment, you should download the files in TTS_UNIT that contains the project TTS_UNIT (The code for the project is reflected here for convenience). To get it to work, you can register the TTS_INTRACTV_TESTR component under a menu of your choosing, or else the project file will contain a Content Reference for it (under Root, I think...). The "TTS" code will be up to date, but if you plan on using my custom class to help you, I would then copy the code from github into app designer for Y_TEST:BaseTest.

Writing your class

Once you have done that, you can go into the code for my custom class and copy the first bit of code, which is a template for new classes. For convenience, this is the code contained there:

/* Basic Test-Class structure 
import Y_TEST:BaseTest;

class Test-Class extends Y_TEST:BaseTest
   method Test-Class();
   method RunHook();
protected
   rem tests;
private
   rem helper methods;
end-class;

method Test-Class
   %Super = create Y_TEST:BaseTest("Test-Class");
end-method;

method RunHook
   /+ Extends/implements Y_TEST:BaseTest.Run +/
   rem either run manually;
   rem <run test methods>
   rem %This.tests = <number-of-tests-run>;
   
   rem or run automatically;
   rem %This.runTestMethodsInClass(String(%this));
end-method;
*/

Replace Test-Class everywhere that it appears with the name of your test class. Put new test methods in the class definition (probable in the protected section under rem tests;, and replace <run test methods> with calls to the methods you put there. Finally, if you want, you can replace <number-of-tests-run> in %This.tests = <number-of-tests-run>; with a number that indicates the actual number of methods that you want. This is used in the output for tests.

Adding your class to the Framework

Once you have moved the project into the desired environment, navigate to the content reference. Once there, you can add a new test:

Adding a New Test

Call it what you will. Then you will enter a landing page:

Landing Page

You can click the top tab that is called Add/Delete Tests. That will take you to this page:

Adding a New Test Class

Once you add the class you want, you can return to the landing page, check the test you want to run, and then run it:

Landing Page with Test to Run

peoplesoft-psunit's People

Contributors

cache117 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

peoplesoft-psunit's Issues

Question

Hello Cache,

First thank you for sharing this useful framework.
I want to ask if your program supports PeopleSoft 9.2 and PTools 8.56?

Best regards,

Minh

Questions

Hello is me again,

I have some more questions and hope you guys can help. Do you know if there are any way to:

  • Show code coverage for PSUnit?
  • Make sure that code has been tested by developers using PSUnit (Proof, logs...)

Thanks in advance! ๐Ÿ˜„

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.