- Clone the git repo — git clone https://github.com/codio/atests-simple.git
- Install java jdk
- Install maven
- Create src/test/resources/config.properties file and set teacher (teacher should be already added to organization) and students (this example needs 4 test students, no matter already added to org, or new) credentials in it, like:
teacher.login = loginhere
teacher.email = [email protected]
teacher.firstName = namehere
teacher.lastName = lastnamehere
teacher.password = passwordhere
student1.login = student1loginhere
... and so on
- Run src/test/java/helpers/COneCreateCourseHelper (in console
mvn clean -Dtest=COneCreateCourseHelper test
). It will create test course - To run all tests go to project's root and on command line run
mvn clean test
or import project as maven module to IDE and run as junit tests. See Run tests for more options - To see results of tests in Allure go to project's root and on command line run
mvn allure:serve
It's possible to specify properties (such as environment, runType etc) in src/test/resources/config.properties file. By default tests run on prod in Chrome browser Also some properties can be specified as arguments in command line To run tests from command line go to project's root and use commands in terminal:
mvn clean test
- runs all tests with default configmvn clean test -DbaseUrl="prod"
- runs tests on prod. Acceptable values: prodmvn clean test -Dbrowser="firefox"
- runs tests with firefox browser. Browser should be installed in OS. Acceptable values: chrome, firefoxmvn clean test -Dheadless="true"
- runs tests in headless mode. Acceptable values: true, falsemvn clean -Dtest=COneVariablesPageTryItOneByOneTest test
- runs all tests from LoginTest classmvn clean -Dtest=*OneByOne* test
- runs tests from classes whose name contains "Login"mvn clean -Dtest=COneVariablesPageTryItOneByOneTest#secondTryIt test
- runs secondTryIt test from COneVariablesPageTryItOneByOneTest classmvn clean -Dgroups="content, assignment" test
- runs all tests with@Tag("course")
and all tests with@Tag("project")
Table of available tests with tags
More info about running tests by maven there
After code editing use auto-formatting and style checks
A code could be formatted in automatic way with Maven command:
mvn spotless:apply
Formatting could be checked with Maven command:
mvn spotless:check
Additional rules could be checked with Maven command:
mvn checkstyle:checkstyle
If this command fails, tests can't be run by maven (e.g. by mvn clean test
command). To fix it mvn spotless:apply
should be run. Sometimes manual fixing needed