Mercurial > hg > ThermostatQA
changeset 82:3eaf72da3c84
modifying CliClientDBModificationsTest testsuite
author | Jana Fabrikova <jfabriko@redhat.com> |
---|---|
date | Wed, 17 Jul 2013 17:52:14 +0200 |
parents | ea3f2926eea3 |
children | 3635aea515f6 |
files | ChangeLog src/org/thermostat/qa/framework/ThermostatTest.java src/org/thermostat/qa/testsuites/CliClientDBModificationsSmokeTest.java |
diffstat | 3 files changed, 32 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jul 17 15:02:38 2013 +0200 +++ b/ChangeLog Wed Jul 17 17:52:14 2013 +0200 @@ -1,3 +1,10 @@ +2013-07-17 Jana Fabrikova <jfabriko@redhat.com> + * src/org/thermostat/qa/framework/ThermostatTest.java: + added method (checkPresenceOfPatterns) + * src/org/thermostat/qa/testsuites/CliClientDBModificationsSmokeTest.java: + updating the testcase (testAddVMAndSeeItInShellTest) so it can find + the added vm anywhere in the list-vms list + 2013-07-17 Jana Fabrikova <jfabriko@redhat.com> * outputtexts/version1: adding 2 output text files for CliClientSmokeTest testsuite
--- a/src/org/thermostat/qa/framework/ThermostatTest.java Wed Jul 17 15:02:38 2013 +0200 +++ b/src/org/thermostat/qa/framework/ThermostatTest.java Wed Jul 17 17:52:14 2013 +0200 @@ -271,5 +271,25 @@ { Assert.assertEquals(line1, line2, line1 + " != " + line2); } + + /** + * Method checkPresenceOfPatterns returns true iff all the patterns are + * present in text. + * + * @param text + * @param patterns + * @return + */ + protected boolean checkPresenceOfPatterns(String text, String[] patterns) { + boolean result = true; + for(String p : patterns) + { + if(!text.contains(p)) + { + result = false; + } + } + return result; + } }
--- a/src/org/thermostat/qa/testsuites/CliClientDBModificationsSmokeTest.java Wed Jul 17 15:02:38 2013 +0200 +++ b/src/org/thermostat/qa/testsuites/CliClientDBModificationsSmokeTest.java Wed Jul 17 17:52:14 2013 +0200 @@ -126,12 +126,13 @@ Assert.assertTrue(headerLine.contains(headerElem), headerElem + " not in the header of thermostat shell output"); } - String vmsLine = output1.get(3); - for (String vmElem : new String[] { "non-existing-agent-no1", "artif.added.host0.name", "12345", "RUNNING", "unknown" }) + boolean addedVmPresent = false; + for(String vmsLine : output1) { - Assert.assertTrue(vmsLine.contains(vmElem), vmElem + " not in the vm line of thermostat shell output"); + addedVmPresent = addedVmPresent || checkPresenceOfPatterns(vmsLine, new String[] { "non-existing-agent-no1", "artif.added.host0.name", "12345", "RUNNING", "unknown" }); } - + Assert.assertTrue(addedVmPresent," added vm not listed in the output"); + // remove the added vm from db List<String> output2 = runHelperBashScript("delete_added_vm.sh"); for (String s : output2)