Skip to content

Instantly share code, notes, and snippets.

@philcruz
Created September 29, 2016 17:51
Show Gist options
  • Save philcruz/5ba35f96897062b082cacba5a6024e2d to your computer and use it in GitHub Desktop.
Save philcruz/5ba35f96897062b082cacba5a6024e2d to your computer and use it in GitHub Desktop.
component extends="testbox.system.BaseSpec"{
//this will run before every single test in this test case --->
public void function setUp(){
}
//this will run after every single test in this test case --->
public void function tearDown(){
}
//this will run once after initialization and before setUp() --->
public void function beforeTests(){
variables.beanFactory = createObject("component", "coldspring.beans.DefaultXmlBeanFactory").init();
variables.beanFactory.loadBeans( expandPath('/config/coldspring.xml') );
variables.objectFactory = variables.beanFactory.getBean("objectFactory");
variables.stringUtils = variables.beanFactory.getBean("stringUtils");
}
//this will run once after all tests have been run --->
public void function afterTests(){
}
public void function test_betaTesters_save(){
var betaTester = EntityLoadByPK("BetaTester", 15);
var expectedResult = stringUtils.randomString("ALPHA", 10);
betaTester.setName(expectedResult);
betaTester.save();
var bt = queryExecute("select name from betaTesters where betaTesterID = 15");
var result = bt.name;
$assert.isEqual(expectedResult,result,"result should've been '#expectedResult#' but was #result#");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment