STest.java [test/service_tests] Revision: 5660378d7d35e4f1abbffb027c0f9eaa1acf1a90 Date: Tue May 31 11:12:26 MDT 2016
package service_tests;
import csip.test.ServiceTest2;
import java.io.File;
import java.util.Properties;
import org.codehaus.jettison.json.JSONArray;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
/**
*
* @author od
*/
public class STest {
@Rule
public TestName name = new TestName();
private void run() throws Exception {
String testFolder = new File(getClass().getCanonicalName().replace('.', '/')).getParent();
JSONArray r = ServiceTest2.run(new Properties(), "test/" + testFolder + "/" + name.getMethodName() + ".json");
Assert.assertTrue(r.getJSONObject(0).getInt("successful") == 1);
}
/*
1. Run a service against an endpoint.
2. If successful, store the response in 'tests/service_tests'
3. Name it : <servicepath>__<name>.json
Example:
The service response is 'alfafa.json' and ran
successfully against
http://csip.engr.colostate.edu/csip-erosion/m/weps/1.3
store this response as
tests/service_tests/m_weps_1_3__alfalfa.json
- replace '/' with '_'
- replace '.' with '_'
- separate both parts with '__'
4. Add a new JUnit test for this service to this file:
@Test public void m_weps_1_3__alfalfa() throws Exception {
run();
}
The test method name and the name of the json file
(without the extension) must match!
This is it!
*/
@Test public void m_nutrient_slp_1_0__moderate() throws Exception { run(); }
@Test public void m_ipmscoresfull_1_0_1__getfull() throws Exception { run(); }
@Test public void m_nut_pract_scores_1_0__test_1() throws Exception { run(); }
@Test public void m_nut_tech_scores_1_0__test_1() throws Exception { run(); }
@Test public void m_nutrient_slp_1_0__moderate_1() throws Exception { run(); }
@Test public void m_nutrient_slp_1_0__simple_1() throws Exception { run(); }
@Test public void m_nutrient_slp_1_0__ser_1() throws Exception { run(); }
@Test public void m_nutrient_slp_1_0__test1() throws Exception { run(); }
@Test public void m_nutrient_slp_1_0__test2() throws Exception { run(); }
@Test public void m_pestlosspot_1_0__test_1() throws Exception { run(); }
@Test public void m_pestipmscoresfull_1_0__test_1() throws Exception { run(); }
@Test public void m_pestmigtechsfull_1_0__test_1() throws Exception { run(); }
@Test public void m_pesticide_practice_score_1_0__test_1() throws Exception { run(); }
@Test public void m_sednutpractscoresfull_1_0__test_1() throws Exception { run(); }
@Test public void m_pest_hazrating_1_0__test_1() throws Exception { run(); }
@Test public void m_pest_techn_scores_1_0__test_1() throws Exception { run(); }
@Test public void m_pesticide_ipm_score_1_0__test_1() throws Exception { run(); }
@Test public void m_pesticide_sarp_1_0__test_1() throws Exception { run(); }
@Test public void m_pesticide_slp_1_0__test_1() throws Exception { run(); }
@Test public void m_pesticide_slp_1_0__test_2() throws Exception { run(); }
@Test public void m_pesticide_ssrp_1_0__complex_1() throws Exception { run(); }
@Test public void m_pesticide_ssrp_1_0__simple_1() throws Exception { run(); }
@Test public void m_pestlosspot_1_0__test_2() throws Exception { run(); }
@Test public void m_rfactor_1_0__test_1() throws Exception { run(); }
@Test public void m_rfactor_1_0__test_2() throws Exception { run(); }
@Test public void m_scsednut_srp_1_0__test_1() throws Exception { run(); }
@Test public void m_thresholdscores_1_0__test_1() throws Exception { run(); }
@Test public void m_nutappmgtscores_1_0__test_1() throws Exception { run(); }
@Test public void m_wqmscorebar_1_0__test_1() throws Exception { run(); }
@Test public void m_soilpestlosspot_1_0__test_1() throws Exception { run(); }
@Test public void m_wqmsoilattributes_1_0__test_1() throws Exception { run(); }
@Test public void m_nut_pract_scores_1_0__ser_1() throws Exception { run(); }
@Test public void m_nut_tech_scores_1_0__ser_1() throws Exception { run(); }
@Test public void m_nutappmgtscores_1_0__ser_1() throws Exception { run(); }
@Test public void m_nutrientslpsrp_1_0__ser_1() throws Exception { run(); }
@Test public void m_nutrientslpsrp_1_0__ser_2() throws Exception { run(); }
@Test public void m_pest_hazrating_1_0__ser_1() throws Exception { run(); }
@Test public void m_pest_techn_scores_1_0__ser_1() throws Exception { run(); }
@Test public void m_pesticide_ipm_score_1_0__ser_1() throws Exception { run(); }
@Test public void m_pesticide_practice_score_1_0__ser_1() throws Exception { run(); }
@Test public void m_pesticide_sarp_1_0__ser_1() throws Exception { run(); }
@Test public void m_pesticide_slp_1_0__ser_1() throws Exception { run(); }
@Test public void m_pesticide_ssrp_1_0__ser_1() throws Exception { run(); }
@Test public void m_pestlosspot_1_0__ser_1() throws Exception { run(); }
@Test public void m_pestprodlist_1_0__ser_1() throws Exception { run(); }
@Test public void m_rfactor_1_0__ser_1() throws Exception { run(); }
@Test public void m_scsednut_srp_1_0__ser_1() throws Exception { run(); }
@Test public void m_soilpestlosspot_1_0__ser_1() throws Exception { run(); }
@Test public void m_tresholdscores_1_0__ser_1() throws Exception { run(); }
@Test public void m_wqmscorebar_1_0__ser_1() throws Exception { run(); }
@Test public void m_wqmsoilattributes_1_0__ser_1() throws Exception { run(); }
@Test public void m_wqsr_1_0__test1() throws Exception { run(); }
@Test public void m_wqsr_1_0__test2() throws Exception { run(); }
@Test public void m_wqsr_1_0__test3() throws Exception { run(); }
@Test public void m_nut_tech_scores_1_0__bug_1() throws Exception { run(); }
@Test public void m_nut_tech_scores_1_0__bug_2() throws Exception { run(); }
@Test public void m_pestlosspot_1_0__bug_1() throws Exception { run(); }
@Test public void m_scsednut_srp_1_0__bug_1() throws Exception { run(); }
@Test public void m_wqmsoilattributes_1_0__bug_1() throws Exception { run(); }
// .. more here
}