Project Overview: This project focuses on testing a server-side calculator application using CIM (Component interaction Model), ATG (Application Transition Graph) Modelling. The goal is to model the server-side code interactions and create effective test cases for comprehensive coverage.
Steps to Follow:
- Understanding and Modeling the Server-Side Code
- Test Case Design
- Tool Selection
- Execution and results
The identification of atomic sections allows for focused testing within the context of CIM and ATG. Testing specific functionalities or interactions becomes more manageable and targeted.
We generated CIM Graphs for our node server and then we combined them to get ATG.
CIM examples (All CIM's can be found in CIM)
ATG Graph
In ATG each node is a cim, transition among cim graphs are represented with edges.
Mocha: Chosen for its robust testing framework, especially its support for asynchronous testing.
Chai: Utilized for expressive and readable assertions, enhancing test readability and understanding.
Chai-HTTP: Specifically employed for testing HTTP services/APIs, providing specialized assertions for API testing.
- using domain knowledge
- using Modeled CIM/ATG
Application of Graph-Based Testing:
Coverage Criteria: Utilizing graph-based coverage criteria (such as node coverage, edge coverage, etc.) to ensure that each node/state and transition in the ATG is covered by test cases.
Path Analysis: Analyzing paths through the ATG to derive test scenarios and identify critical paths that require testing to ensure system reliability and functionality.
coverage
addition : p1.p2 + p1.p3.(p0)*.p4.(p5 + p6).p7
substraction : p1.(p2 + p3.p4 + p3.p5.p6.(p7 + p8).p9)
square root : p1.(p2 + p3.p4 + p3.p5.p6.(p7 + p8).p9)
power : p1.(p2 + p3.p4 + p3.p5.p6.(p7 + p8).p9)
factorial : p1.(p2 + p3.p4 + p3.p5.(p6*).p7.p8.(p9 + p10).p11)
Example the above code shows path coverage for the path p1->p3->p5->p6->p7->p9 for division.js and it's CIM looks like the below image.
The above model inturn maps to our source code in divions.js shown below
result: The graph based approch helped us reveal that a test case is failing in division.js and the remaining paths passes succesfully.
Benefits Derived: Graph-based testing ensures that test cases cover all possible paths and scenarios defined within the CIM/ATG, minimizing the chances of undiscovered issues.
- graphical representations of CIM can be found in /server/CIM/
- graphical representations of ATG can be found in /server/ATG
- tests can be run by doing the following
cd server
npm i
setup .env file
npm test
Aman : CIMs and modules for substraction, sqrt, multiplication, factorial
Prathviraj : CIMs and modules for addition, division, power, log