Unit Testing with Ianus
Ianus can be easily used with Visual Studio Unit Test projects, allowing the verification of application components performing massive data processing while leveraging the powerful unit test management capabilities provided by Visual Studio.
Although unorthodox, this approach may result being very proficient with procedural components such as, for example, migrated legacy application, where a single run unit (i.e. a COBOL program or more often a single JCL) may perform thousands of read and write operations on databases and files.
The unit test method will have to include:
- Code to activate the procedural component (optional). For example the C# method could invoke a PowerShell script submitting the job to the desired JES-like server (i.e. MFES for .NET JES)
- Code to execute the Ianus code to verify the outcome for code being tested
- Assertions to validate the test
[TestMethod]
public void TestJob_JJACME01()
{
// executes the job JJACME01
JobUtils.SubmitAndWait("JJACME01");
// runs the Ianus job and checks the final job status
HPE.Ianus.Environment env =
new HPE.Ianus.Environment(Assembly.GetExecutingAssembly(),
"UnitTest.Environment.xml");
Job job = new Job(env, Assembly.GetExecutingAssembly(),
"UnitTest.JJACME01.xml");
job.Start();
job.Execute("TBLCMP01");
job.End();
// Validates the test
Assert.AreEqual(Ianus.Job.JobStatus.Success, job.Status);
}