Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Modern Development Workflow
1. The Modern Development Workflow
Automate, Automate, Automate!
Net Perspective, LLC.
http://www.net-perspective.com/
2. Before We Get Started…
• I Am…
o Daniel Cousineau
• Lead Developer at Net Perspective, LLC
• dcousineau@net-perspective.com
• We Are…
o Full service web agency (development) firm based out of
College Station, TX
• About This Topic…
o The utilities presented are biased towards PHP and OSS
• All are interchangeable with other languages and utilities
o We are always improving and getting better
o Constructive feedback always welcome
Net Perspective, LLC.
http://www.net-perspective.com/
3. Source Control
• More than 0 people on a project?
o Extremely beneficial when with 2+ member teams
• SVN most popular
o Integration with EVERYTHING
o Showing its age
• No native branching/tagging
• GIT: the up-and-coming superstar
o Not as well integrated
o Still new
Net Perspective, LLC.
http://www.net-perspective.com/
4. Unit Testing
• Old and Busted: GDB, New Hotness: TDD
o Test Driven Development
o Write tests first, code until all tests pass
• PHPUnit very popular
o Based on the NUnit standard (JUnit sound familiar?)
• Our Goal? 100% Code Coverage
o Means every line of source code should have been
executed at least once when all tests completed
• Alternatives
o SimpleTest, PHPT
Net Perspective, LLC.
http://www.net-perspective.com/
5. PHPUnit Example
class StringFunctionTest extends PHPUnit_Framework_TestCase
{
protected $_fixture;
//Run before each test
public function setup()
{
$this->_fixture = fopen(quot;./sample.txtquot;,quot;wquot;);
}
//Example test
public function testStrToLower()
{
//Object is constructed/destructed after each test
//Data saved to a fixture here is not preserved for the next test
$actual = strtolower(quot;SaMpLequot;);
$expected = quot;samplequot;;
$this->assertEquals($expected, $actual, 'comment here'); //
}
//Run after each test
public function tearDown()
{
fclose($this->_fixture);
}
}
Net Perspective, LLC.
http://www.net-perspective.com/
6. Build Management
• Generating AutoDoc, running UnitTests, and
packaging is BORING
o “Laziness is the mark of a great developer” – Me
• Automate with Phing
o Native PHP build system based on the popular Ant build
system for Java
o $ phing TARGET_NAME
• Looks for build.xml which contains commands for the target
o Tasks for running PHPDoc, PHPUnit, and…
Net Perspective, LLC.
http://www.net-perspective.com/
8. Database Versioning
• DBDeploy
o Every change to the database structure is in its own .sql file
• Each file contains the SQL to perform changes and SQL to roll back
those changes
o Revision information is stored in a table
o Written in Java, Phing has a native port built in
o Only version structure changes and default values
• Don’t version test and sample data!
Net Perspective, LLC.
http://www.net-perspective.com/
10. Continuous Integration
• Wraps everything up…
o Ties in Versioning, Build Management, Unit Testing, [Auto
generated Documentation, ] and Database Versioning
o Xinc (http://xinc.eu) (a pure PHP solution)
• CruiseControl would be the “original”
• What happens?
o CI monitors SVN working copy
o On update, run specified build script (Phing)
• Phing generates UnitTest reports, API documentation, and archive files
• Deployment code (upload to live server?)
• UnitTest fails? Build fails
o Store “artifacts” (generated reports, etc.) for each build
Net Perspective, LLC.
http://www.net-perspective.com/
11. Xinc Interface
Notice the Deliverable and Documentation artifacts
Net Perspective, LLC.
http://www.net-perspective.com/
12. In Conclusion
Charts Are Useless
Pac Man
Blinky
Net Perspective, LLC.
http://www.net-perspective.com/