Search in sources :

Example 1 with QTI21MatchEditorPage

use of org.olat.selenium.page.qti.QTI21MatchEditorPage in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorMatchDragAndDrop.

/**
 * An author make a test with 2 match of the drag and drop variety
 * with feedbacks.<br>
 * A first user make the test, check the feedbacks but make an error
 * and score the maximum. A second user answers all the questions
 * correctly.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorMatchDragAndDrop(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    UserVO chara = new UserRestClient(deploymentUrl).createRandomUser("Chara");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Match DnD QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a match, multiple selection
    QTI21MatchEditorPage matchEditor = qtiEditor.addMatchDragAndDrop();
    matchEditor.setSource(0, "Einstein").setSource(1, "Planck").addRow().setSource(2, "Euler").setTarget(0, "Physicist").setTarget(1, "Mathematician").setMatch(0, 0, true).setMatch(1, 0, true).setMatch(2, 1, true).save();
    // change max score
    matchEditor.selectScores().setMaxScore("4").save();
    // set some feedbacks
    matchEditor.selectFeedbacks().setHint("Hint", "Euler come from Switzerland").setCorrectSolution("Correct solution", "The correct solution is simple").setCorrectFeedback("Correct feedback", "You are right").setIncorrectFeedback("Incorrect", "Your answer is not exactly correct").save();
    // second match
    matchEditor = qtiEditor.addMatchDragAndDrop().setSingleChoices().setSource(0, "Euler").setSource(1, "Broglie").addRow().setSource(2, "Konrad").setTarget(0, "Mathematics").setTarget(1, "Medicine").addColumn().setTarget(2, "Physics").setMatch(0, 0, true).setMatch(1, 2, true).setMatch(2, 1, true).save();
    // select score "per answer" and set the scores
    matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("8").setScore(0, 0, "2.0").setScore(0, 1, "0.0").setScore(0, 2, "0.0").setScore(1, 0, "0.0").setScore(1, 1, "0.0").setScore(1, 2, "3.0").setScore(2, 0, "0.0").setScore(2, 1, "2.0").setScore(2, 2, "0.0").save();
    matchEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // close editor
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage asukaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    asukaLoginPage.loginAs(asuka.getLogin(), asuka.getPassword()).resume();
    NavigationPage asukaNavBar = new NavigationPage(participantBrowser);
    asukaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page asukaQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    asukaQtiPage.assertOnAssessmentItem().answerMatchDropSourceToTarget("Einstein", "Physicist").answerMatchDropSourceToTarget("Planck", "Mathematician").answerMatchDropSourceToTarget("Euler", "Mathematician").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatchDropTargetToTarget("Planck", "Physicist").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatchDropSourceToTarget("Broglie", // 2 points
    "Physics").answerMatchDropSourceToTarget("Euler", // 2 points
    "Medicine").answerMatchDropSourceToTarget("Konrad", // 3 points
    "Medicine").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(9);
    // a second user search the content package
    LoginPage charaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    charaLoginPage.loginAs(chara.getLogin(), chara.getPassword()).resume();
    NavigationPage charaNavBar = new NavigationPage(participantBrowser);
    charaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page.getQTI12Page(participantBrowser).answerMatchDropSourceToTarget("Einstein", "Physicist").answerMatchDropSourceToTarget("Planck", "Physicist").answerMatchDropSourceToTarget("Euler", "Mathematician").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatchDropSourceToTarget("Broglie", // 2 points
    "Physics").answerMatchDropSourceToTarget("Euler", // 2 points
    "Mathematics").answerMatchDropSourceToTarget("Konrad", // 3 points
    "Medicine").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 7 from the second
    11);
}
Also used : QTI21MatchEditorPage(org.olat.selenium.page.qti.QTI21MatchEditorPage) QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with QTI21MatchEditorPage

use of org.olat.selenium.page.qti.QTI21MatchEditorPage in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorMatchTrueFalse.

/**
 * An author make a test with 2 matches of the True/false variant. A match
 * with score "all answers", a second with score "per answers".<br>
 * A first user make the test, but doesn't answer all questions
 * correctly, log out and a second user make the perfect test.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorMatchTrueFalse(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "True false QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a match, score "all answers"
    QTI21MatchEditorPage matchEditor = qtiEditor.addMatchTrueFalse();
    matchEditor.setSource(0, "Eclipse is a Java IDE").setSource(1, "vim is Database viewer").setMatch(0, 1, true).setMatch(1, 2, true).save();
    // change max score
    matchEditor.selectScores().setMaxScore("4").save();
    // set some feedbacks
    matchEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // second match
    matchEditor = qtiEditor.addMatchTrueFalse().setSource(0, "Java has several IDE like Eclipse").setSource(1, "C is object oriented").addRow().setSource(2, "What do you think of PHP?").setMatch(0, 1, true).setMatch(1, 2, true).setMatch(2, 0, true).save();
    // select score "per answer" and set the scores
    matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("3").setScore(0, 0, "0.0").setScore(0, 1, "1.0").setScore(0, 2, "0.0").setScore(1, 0, "0.0").setScore(1, 1, "0.0").setScore(1, 2, "1.0").setScore(2, 0, "1.0").setScore(2, 1, "0.0").setScore(2, 2, "0.0").save();
    matchEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
    NavigationPage reiNavBar = new NavigationPage(participantBrowser);
    reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    reiQtiPage.assertOnAssessmentItem().answerMatch("Eclipse", TrueFalse.right, true).answerMatch("vim", TrueFalse.right, true).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatch("vim", TrueFalse.wrong, true).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", TrueFalse.right, true).answerMatch("oriented", TrueFalse.wrong, true).answerMatch("PHP", TrueFalse.wrong, true).saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 2 from the second
    6);
    // a second user search the content package
    LoginPage asukaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    asukaLoginPage.loginAs(asuka.getLogin(), asuka.getPassword()).resume();
    NavigationPage asukaNavBar = new NavigationPage(participantBrowser);
    asukaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerMatch("Eclipse", TrueFalse.right, true).answerMatch("vim", TrueFalse.wrong, true).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", TrueFalse.right, true).answerMatch("oriented", TrueFalse.wrong, true).saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 6 from the second
    7);
}
Also used : QTI21MatchEditorPage(org.olat.selenium.page.qti.QTI21MatchEditorPage) QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 3 with QTI21MatchEditorPage

use of org.olat.selenium.page.qti.QTI21MatchEditorPage in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorMatch_distractors.

/**
 * An author make a test with 2 matches. A match with "multiple selection"
 * and score "all answers", a second with "single selection" and score
 * "per answers". They are distractors, the assessed user must let them blank.<br>
 * A first user make the test, but doesn't answer all questions
 * correctly, log out and a second user make the perfect test.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorMatch_distractors(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO melissa = new UserRestClient(deploymentUrl).createRandomUser("Melissa");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Match QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a match, multiple selection
    QTI21MatchEditorPage matchEditor = qtiEditor.addMatch();
    matchEditor.setSource(0, "Eclipse").setSource(1, "nano").setTarget(0, "IDE").setTarget(1, "WordProcessor").addColumn().setTarget(2, "CAD").save();
    // change max score
    matchEditor.selectScores().setMaxScore("4").save();
    // set some feedbacks
    matchEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // second match
    matchEditor = qtiEditor.addMatch().setSingleChoices().setSource(0, "Java").setSource(1, "C").addRow().setSource(2, "PHP").setTarget(0, "Lynx").setTarget(1, "Netscape").addColumn().setTarget(2, "Pixel").save();
    // select score "per answer" and set the scores
    matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("6").setScore(0, 0, "0.0").setScore(0, 1, "0.0").setScore(0, 2, "1.0").setScore(1, 0, "0.0").setScore(1, 1, "1.0").setScore(1, 2, "0.0").setScore(2, 0, "2.0").setScore(2, 1, "0.0").setScore(2, 2, "-0.5").save();
    matchEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
    NavigationPage reiNavBar = new NavigationPage(participantBrowser);
    reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    reiQtiPage.assertOnAssessmentItem().answerMatch("Eclipse", "WordProcessor", true).answerMatch("nano", "CAD", true).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatch("nano", "CAD", false).answerMatch("Eclipse", "WordProcessor", false).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", "Pixel", true).answerMatch("C", "Lynx", true).answerMatch("PHP", "Pixel", true).saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 0.5 from the second
    "4.5");
    // a second user search the content package
    LoginPage melLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    melLoginPage.loginAs(melissa.getLogin(), melissa.getPassword()).resume();
    NavigationPage melNavBar = new NavigationPage(participantBrowser);
    melNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", "Pixel", true).answerMatch("C", "Pixel", true).answerMatch("PHP", "Lynx", true).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").answerMatch("Java", "Pixel", false).answerMatch("C", "Pixel", false).answerMatch("PHP", "Lynx", false).saveAnswer().assertFeedback("Correct feedback").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 6 from the second
    10);
}
Also used : QTI21MatchEditorPage(org.olat.selenium.page.qti.QTI21MatchEditorPage) QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 4 with QTI21MatchEditorPage

use of org.olat.selenium.page.qti.QTI21MatchEditorPage in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorMatchDragAndDrop_distractors.

/**
 * An author make a test with 2 match of the drag and drop variety
 * with feedbacks but as distractor. The assessed user need to let them
 * blank to have the max. score.<br>
 * A first user make the test, check the feedbacks but make an error
 * and score the maximum. A second user answers all the questions
 * correctly.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorMatchDragAndDrop_distractors(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    UserVO chara = new UserRestClient(deploymentUrl).createRandomUser("Chara");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Match DnD QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a match, multiple selection
    QTI21MatchEditorPage matchEditor = qtiEditor.addMatchDragAndDrop();
    matchEditor.setSource(0, "Einstein").setSource(1, "Planck").addRow().setSource(2, "Euler").setTarget(0, "Chemistry").setTarget(1, "Philosophy").save();
    // change max score
    matchEditor.selectScores().setMaxScore("4").save();
    // set some feedbacks
    matchEditor.selectFeedbacks().setHint("Hint", "Euler come from Switzerland").setCorrectSolution("Correct solution", "The correct solution is simple").setCorrectFeedback("Correct feedback", "You are right").setIncorrectFeedback("Incorrect", "Your answer is not exactly correct").save();
    // second match
    matchEditor = qtiEditor.addMatchDragAndDrop().setSingleChoices().setSource(0, "Euler").setSource(1, "Broglie").addRow().setSource(2, "Konrad").setTarget(0, "Chemistry").setTarget(1, "Biology").addColumn().setTarget(2, "Astrology").save();
    // select score "per answer" and set the scores
    matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("8").setScore(0, 0, "1.0").setScore(0, 1, "0.0").setScore(0, 2, "0.0").setScore(1, 0, "0.0").setScore(1, 1, "0.0").setScore(1, 2, "-0.5").setScore(2, 0, "0.0").setScore(2, 1, "2.0").setScore(2, 2, "0.0").save();
    matchEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // close editor
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage asukaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    asukaLoginPage.loginAs(asuka.getLogin(), asuka.getPassword()).resume();
    NavigationPage asukaNavBar = new NavigationPage(participantBrowser);
    asukaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page asukaQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    asukaQtiPage.assertOnAssessmentItem().answerMatchDropSourceToTarget("Einstein", "Chemistry").answerMatchDropSourceToTarget("Planck", "Philosophy").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatchDetarget("Planck").answerMatchDetarget("Einstein").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatchDropSourceToTarget("Broglie", // -0.5 points
    "Astrology").answerMatchDropSourceToTarget("Euler", // 1 points
    "Chemistry").answerMatchDropSourceToTarget("Konrad", // 0 points
    "Chemistry").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore("4.5");
    // a second user search the content package
    LoginPage charaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    charaLoginPage.loginAs(chara.getLogin(), chara.getPassword()).resume();
    NavigationPage charaNavBar = new NavigationPage(participantBrowser);
    charaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page.getQTI12Page(participantBrowser).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatchDropSourceToTarget("Broglie", // 2 points
    "Chemistry").answerMatchDropSourceToTarget("Euler", // 2 points
    "Astrology").answerMatchDropSourceToTarget("Konrad", // 3 points
    "Astrology").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").answerMatchDetarget("Broglie").answerMatchDetarget("Euler").answerMatchDetarget("Konrad").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 8 from the second
    12);
}
Also used : QTI21MatchEditorPage(org.olat.selenium.page.qti.QTI21MatchEditorPage) QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 5 with QTI21MatchEditorPage

use of org.olat.selenium.page.qti.QTI21MatchEditorPage in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorMatch.

/**
 * An author make a test with 2 matches. A match with "multiple selection"
 * and score "all answers", a second with "single selection" and score
 * "per answers".<br>
 * A first user make the test, but doesn't answer all questions
 * correctly, log out and a second user make the perfect test.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorMatch(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO melissa = new UserRestClient(deploymentUrl).createRandomUser("Melissa");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Match QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a match, multiple selection
    QTI21MatchEditorPage matchEditor = qtiEditor.addMatch();
    matchEditor.setSource(0, "Eclipse").setSource(1, "vim").setTarget(0, "IDE").setTarget(1, "TextProcessor").addColumn().setTarget(2, "TextEditor").setMatch(0, 0, true).setMatch(1, 2, true).save();
    // change max score
    matchEditor.selectScores().setMaxScore("4").save();
    // set some feedbacks
    matchEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // second match
    matchEditor = qtiEditor.addMatch().setSingleChoices().setSource(0, "Java").setSource(1, "C").addRow().setSource(2, "PHP").setTarget(0, "CodeIgniter").setTarget(1, "VisualStudio").addColumn().setTarget(2, "Eclipse").setMatch(0, 2, true).setMatch(1, 1, true).setMatch(2, 0, true).save();
    // select score "per answer" and set the scores
    matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("6").setScore(0, 0, "0.0").setScore(0, 1, "0.0").setScore(0, 2, "2.0").setScore(1, 0, "0.0").setScore(1, 1, "3.0").setScore(1, 2, "0.0").setScore(2, 0, "1.0").setScore(2, 1, "0.0").setScore(2, 2, "0.0").save();
    matchEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
    NavigationPage reiNavBar = new NavigationPage(participantBrowser);
    reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    reiQtiPage.assertOnAssessmentItem().answerMatch("Eclipse", "IDE", true).answerMatch("vim", "IDE", true).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatch("vim", "IDE", false).answerMatch("vim", "TextEditor", true).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", "Eclipse", true).answerMatch("C", "CodeIgniter", true).answerMatch("PHP", "VisualStudio", true).saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 2 from the second
    6);
    // a second user search the content package
    LoginPage melLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    melLoginPage.loginAs(melissa.getLogin(), melissa.getPassword()).resume();
    NavigationPage melNavBar = new NavigationPage(participantBrowser);
    melNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerMatch("Eclipse", "IDE", true).answerMatch("vim", "TextEditor", true).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", "Eclipse", true).answerMatch("C", "CodeIgniter", true).answerMatch("PHP", "VisualStudio", true).saveAnswer().answerMatch("C", "CodeIgniter", false).answerMatch("PHP", "VisualStudio", false).answerMatch("C", "VisualStudio", true).answerMatch("PHP", "CodeIgniter", true).saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 6 from the second
    10);
}
Also used : QTI21MatchEditorPage(org.olat.selenium.page.qti.QTI21MatchEditorPage) QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)10 Test (org.junit.Test)10 LoginPage (org.olat.selenium.page.LoginPage)10 NavigationPage (org.olat.selenium.page.NavigationPage)10 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)10 QTI21MatchEditorPage (org.olat.selenium.page.qti.QTI21MatchEditorPage)10 QTI21Page (org.olat.selenium.page.qti.QTI21Page)10 UserRestClient (org.olat.test.rest.UserRestClient)10 UserVO (org.olat.user.restapi.UserVO)10