diff --git a/build-system/pom.xml b/build-system/pom.xml index 05987068c84..4f414f36d07 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -1019,6 +1019,34 @@ + + wstest + + + + + maven-surefire-plugin + + true + + + + + + + guitest + + + + + maven-surefire-plugin + + true + + + + + diff --git a/testing/pom.xml b/testing/pom.xml index cb5808bb606..d3693751d22 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -55,6 +55,18 @@ conntest + + guitest + + selenidetest + + + + wstest + + wstest + + diff --git a/testing/selenidetest/pom.xml b/testing/selenidetest/pom.xml index 8b3ae4ca5d2..5043b067631 100644 --- a/testing/selenidetest/pom.xml +++ b/testing/selenidetest/pom.xml @@ -98,4 +98,20 @@ 4.0.6.RELEASE + + + guitest + + + + maven-surefire-plugin + + false + -XX:MaxPermSize=256m + + + + + + \ No newline at end of file diff --git a/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/AbstractSelenideTest.java b/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/AbstractSelenideTest.java index 80222f49e6f..803662608f6 100644 --- a/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/AbstractSelenideTest.java +++ b/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/AbstractSelenideTest.java @@ -7,7 +7,8 @@ import org.springframework.stereotype.Component; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; -import org.springframework.web.context.support.SpringBeanAutowiringSupport; +import org.testng.ITestContext; +import org.testng.annotations.BeforeClass; import java.io.File; import java.util.HashMap; @@ -87,12 +88,14 @@ public class AbstractSelenideTest{ Logger LOGGER = Logger.getLogger(AbstractSelenideTest.class); -// protected AbstractSelenideTest() { -// SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); -// // configure log4j properties file -//// DOMConfigurator.configure("log4j.xml"); -//// PropertyConfigurator.configure("log4j.properties"); -// } + private static final String PARAM_SITE_URL = "site.url"; + public String siteUrl; + + + @BeforeClass(alwaysRun = true) + public void beforeClass(ITestContext context) { + siteUrl = context.getCurrentXmlTest().getParameter(PARAM_SITE_URL); + } //Login util methods /** @@ -100,12 +103,12 @@ public class AbstractSelenideTest{ */ protected void login(){ //perform login - login(SITE_URL, ADMIN_LOGIN, ADMIN_PASSWORD); + login(siteUrl, ADMIN_LOGIN, ADMIN_PASSWORD); } protected void login(String username, String password){ //perform login - login(SITE_URL, username, password); + login(siteUrl, username, password); } protected void login(String siteUrl, String username, String password) { diff --git a/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/basictests/CsvAccountTests.java b/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/basictests/CsvAccountTests.java index c38d7475b8e..7fb7e4d5ca2 100644 --- a/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/basictests/CsvAccountTests.java +++ b/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/basictests/CsvAccountTests.java @@ -49,7 +49,6 @@ public class CsvAccountTests extends AbstractSelenideTest { @Test(priority = 0) public void test001createCsvAccount() { -// LOGGER.info("aaaaaaaaaaaaa"); close(); login(); //check if welcome message appears after user logged in @@ -102,6 +101,16 @@ public void test001createCsvAccount() { System.out.println(isAccountExistInCsvFile(CSV_FILE_PATH, ACCOUNT_NAME_VALUE, ACCOUNT_FIRST_NAME_VALUE, ACCOUNT_LAST_NAME_VALUE, ACCOUNT_PASSWORD_VALUE)); } + /** + * check if account entry was created in the CSV file + * after account creating in the MidPoint + * @param csvFilePath + * @param accountName + * @param accountFirstName + * @param accountLastName + * @param accountPassword + * @return + */ public boolean isAccountExistInCsvFile(String csvFilePath, String accountName, String accountFirstName, String accountLastName, String accountPassword) { BufferedReader br = null; @@ -138,18 +147,17 @@ public boolean isAccountExistInCsvFile(String csvFilePath, String accountName, return false; } + /** + * Update icfccsvfile:filePath tag value, set the correct + * path to midpoint-flatfile.csv file + */ public void updateCsvFilePath() { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(CSV_RESOURCE_XML_PATH); - // Get the staff element , it may not working if tag has spaces, or - // whatever weird characters in front...it's better to use - // getElementsByTagName() to get it directly. - // Node staff = company.getFirstChild(); - - // Get the staff element by tag name directly + // Get the CSV filePath element by tag name directly Node filePathNode = doc.getElementsByTagName("icfccsvfile:filePath").item(0); filePathNode.setTextContent(System.getProperty("user.dir") + "/src/test/resources/mp-resources/midpoint-flatfile.csv"); @@ -159,9 +167,6 @@ public void updateCsvFilePath() { DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(CSV_RESOURCE_XML_PATH)); transformer.transform(source, result); - - System.out.println("Done"); - } catch (ParserConfigurationException pce) { pce.printStackTrace(); } catch (TransformerException tfe) { diff --git a/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/basictests/LoginTest.java b/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/basictests/LoginTest.java index ca141b0c054..fb02d40f345 100644 --- a/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/basictests/LoginTest.java +++ b/testing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/basictests/LoginTest.java @@ -21,9 +21,8 @@ public class LoginTest extends AbstractSelenideTest { */ @Test public void test001loginWithCorrectCredentialsTest(){ - open(SITE_URL); //perform login - login(SITE_URL, ADMIN_LOGIN, ADMIN_PASSWORD); + login(ADMIN_LOGIN, ADMIN_PASSWORD); //check if welcome message appears after user logged in $(byText("welcome to midPoint")).shouldBe(visible); @@ -39,9 +38,8 @@ public void test001loginWithCorrectCredentialsTest(){ */ @Test public void test002loginWithIncorrectUsernameTest(){ - open(SITE_URL); //perform login - login(SITE_URL, "incorrectUserName", ADMIN_PASSWORD); + login("incorrectUserName", ADMIN_PASSWORD); //check if error message appears $(byText("Invalid username and/or password.")).shouldBe(visible); @@ -54,9 +52,8 @@ public void test002loginWithIncorrectUsernameTest(){ */ @Test public void test003loginWithoutUsernameTest(){ - open(SITE_URL); //perform login - login(SITE_URL, "", ADMIN_PASSWORD); + login("", ADMIN_PASSWORD); //check if error message appears $(By.className("messages-error")).find(by("title", "Partial error")).shouldBe(visible); @@ -69,9 +66,8 @@ public void test003loginWithoutUsernameTest(){ */ @Test public void test004loginWithIncorrectPasswordTest(){ - open(SITE_URL); //perform login - login(SITE_URL, ADMIN_LOGIN, "incorrectPassword"); + login(ADMIN_LOGIN, "incorrectPassword"); //check if error message appears $(byText("Invalid username and/or password.")).shouldBe(visible); @@ -84,9 +80,8 @@ public void test004loginWithIncorrectPasswordTest(){ */ @Test public void test005loginWithoutPasswordTest(){ - open(SITE_URL); //perform login - login(SITE_URL, ADMIN_LOGIN, ""); + login(ADMIN_LOGIN, ""); //check if error message appears $(By.className("messages-error")).find(by("title", "Partial error")).shouldBe(visible); diff --git a/testing/selenidetest/testng.xml b/testing/selenidetest/testng.xml index 2fb1277e15e..70005c4245c 100644 --- a/testing/selenidetest/testng.xml +++ b/testing/selenidetest/testng.xml @@ -17,6 +17,7 @@ --> + diff --git a/testing/selenium-tests/pom.xml b/testing/selenium-tests/pom.xml deleted file mode 100644 index ff26a9df222..00000000000 --- a/testing/selenium-tests/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - 4.0.0 - Selenium tests - com.evolveum.midpoint.testing - selenium-tests - 3.3-SNAPSHOT - - - testing - com.evolveum.midpoint - 3.3-SNAPSHOT - - - https://github.com/Evolveum/midpoint.git - git@github.com:Evolveum/midpoint.git - https://fisheye.evolveum.com/browse/midPoint - - - Evolveum - http://www.evolveum.com - - - - Apache License v2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - Atlassian JIRA - http://jira.evolveum.com/ - - - - - maven-surefire-plugin - 2.8.1 - - pertest - classes - false - 1 - alphabetical - - - - - - 2.46.0 - - - - com.evolveum.midpoint.infra - util - 3.3-SNAPSHOT - test - - - org.seleniumhq.selenium - selenium-java - ${selenium.java} - test - - - org.seleniumhq.webdriver - webdriver-firefox - 0.9.7376 - test - - - org.testng - testng - test - - - com.codeborne - selenide - 2.19 - - - \ No newline at end of file diff --git a/testing/selenium-tests/src/test/resources/logback-test.xml b/testing/selenium-tests/src/test/resources/logback-test.xml deleted file mode 100644 index d3649e5b2e5..00000000000 --- a/testing/selenium-tests/src/test/resources/logback-test.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - ./target/test.log - - %date [%thread] %-5level \(%logger{46}\): %message%n - - - - - - - - diff --git a/testing/selenium-tests/testng.xml b/testing/selenium-tests/testng.xml deleted file mode 100644 index 74a633dc4b1..00000000000 --- a/testing/selenium-tests/testng.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/testing/wstest/pom.xml b/testing/wstest/pom.xml index 9a51abae5d4..04dd644a508 100644 --- a/testing/wstest/pom.xml +++ b/testing/wstest/pom.xml @@ -107,7 +107,7 @@ - extratest + wstest diff --git a/testing/wstest/src/test/java/com/evolveum/midpoint/testing/wstest/AbstractWebserviceTest.java b/testing/wstest/src/test/java/com/evolveum/midpoint/testing/wstest/AbstractWebserviceTest.java index 1eb4dabfd34..d30bc54fc26 100644 --- a/testing/wstest/src/test/java/com/evolveum/midpoint/testing/wstest/AbstractWebserviceTest.java +++ b/testing/wstest/src/test/java/com/evolveum/midpoint/testing/wstest/AbstractWebserviceTest.java @@ -216,14 +216,18 @@ protected static ModelPortType createModelPort(String username, String password) * */ protected static ModelPortType createModelPort(String username, String password, String passwordType) { + String endpoint = ENDPOINT; + if (System.getProperty("midpoint.endpoint") != null) { + endpoint = System.getProperty("midpoint.endpoint"); + } LOGGER.info("Creating model client endpoint: {} , username={}, password={}", - new Object[] {ENDPOINT, username, password}); + new Object[] {endpoint, username, password}); ModelService modelService = new ModelService(); ModelPortType modelPort = modelService.getModelPort(); BindingProvider bp = (BindingProvider)modelPort; Map requestContext = bp.getRequestContext(); - requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ENDPOINT); + requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint); org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort); org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();