Hi,
In my previous posts I created a model by name DaxologyTest, a project by name CG_UnitTestCases and a new class by name CGSampleDataTest.
Pre-Requisite:
Daxology model creation and update of references
In this post I will create a test method in the class CGSampleDataTest by name IdExistsTest that checks whether a record with Id value as "1" exists or not in SampleTable
Step 1: In the class declaration set the class to extend SysTestCase class.
class CGSampleDataTest extends SysTestCaseStep 2: Created a test method by name IdExistsTest, added the attribute SysTestMethod and added code as shown below:
class CGSampleDataTest extends SysTestCase{ [SysTestMethod] public void IdExistsTest() { SampleTable sampleTable; boolean idExists;select firstonly RecId from sampleTable where sampleTable.Id == "1";idExists = (sampleTable.RecId) ? (true) : (false);this.assertTrue((idExists == false), "Id exists"); }}Step 3: Build the solution. Executed the test method with the help of Test Explorer by navigating to the path Test > Windows > TestExplorer in Visual Studio.
Step 4: Launched the Test explorer window and selected RunSelectedTests on choosing CGSampleDataTest.IdExistsTest.
Step 5: Executed the test method and had the test result as passed.
Regards,
Chaitanya Golla

Like
Report
*This post is locked for comments