Illustrates how to use Ply for automated API testing. Includes an example GitHub Actions workflow to demonstrate Ply continuous testing.
git clone https://github.com/ply-ct/ply-demo.git
cd ply-demo
npm install
npx ply test/requests/movie-queries.ply.yaml
The output indicates that all movie-queries requests have passed:
Ply version: "3.0.40"
Request 'moviesByYearAndRating' submitted at 4/11/2022, 14:01:18:716
Request 'moviesByYearAndRating' PASSED in 32 ms
Request 'movieById' submitted at 4/11/2022, 14:01:18:745
Request 'movieById' PASSED in 8 ms
Request 'greatFilmsOf1935' submitted at 4/11/2022, 14:01:18:754
Request 'greatFilmsOf1935' PASSED in 7 ms
Request 'bestMovieOf1935' submitted at 4/11/2022, 14:01:18:762
Request 'bestMovieOf1935' PASSED in 6 ms
Request 'stinkersOf1932' submitted at 4/11/2022, 14:01:18:769
Request 'stinkersOf1932' PASSED in 7 ms
Overall Results: {"Passed":5,"Failed":0,"Errored":0,"Pending":0,"Submitted":0}
Overall Time: 126 ms
cd ply-demo
npm test
In package.json scripts, "pretest" starts ply-movies, which serves up the REST API exercised by many of our Ply requests and cases.
Note: Run ply-movies locally in order for destructive tests to succeed.
Install Ply's VS Code extension to run tests in the Test Explorer sidebar.
This simple CI workflow shows how to use npm scripts to automatically execute all requests and cases whenever a commit is pushed on the main branch.
This readme file includes the Ply Action status badge.