Teammates: Unable to run tests in GodMode

Created on 22 Apr 2017  路  15Comments  路  Source: TEAMMATES/teammates

I am trying to run some of the tests in GodMode for the #7179 . But i am getting this error.

java.lang.AssertionError: Student MOTD URL defined in app.student.motd.url in build.properties must not be empty. It is advised to use test-student-motd.html to test it.
    at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
    at teammates.test.driver.TestProperties.verifyReadyForGodMode(TestProperties.java:147)
    at teammates.test.pageobjects.AppPage.regenerateHtmlFile(AppPage.java:881)
    at teammates.test.pageobjects.AppPage.testAndRunGodMode(AppPage.java:873)
    at teammates.test.pageobjects.AppPage.verifyHtmlPart(AppPage.java:856)
    at teammates.test.pageobjects.AppPage.verifyHtmlMainContent(AppPage.java:898)
    at teammates.test.cases.browsertests.AdminHomePageUiTest.testCreateInstructorAction(AdminHomePageUiTest.java:179)
    at teammates.test.cases.browsertests.AdminHomePageUiTest.testAll(AdminHomePageUiTest.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:659)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
    at org.testng.TestRunner.privateRun(TestRunner.java:771)
    at org.testng.TestRunner.run(TestRunner.java:621)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
    at org.testng.SuiteRunner.run(SuiteRunner.java:259)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
    at org.testng.TestNG.run(TestNG.java:1032)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)

a-DevHelp c.Message

Most helpful comment

Hey @AnaghHegde, the fact that that message appeared in the build log tells me that you were trying to run GodMode on Travis. GodMode is only meant to be run locally - as soon as the HTML files have been updated, GodMode should be turned back off.

After taking a look at commit 3360e7b linked from the failed build, my suspicions were confirmed. I guess you forgot to turn GodMode off before committing?

All 15 comments

After adding it in build.properties it worked. But now i am getting unexpected changes in my local environment. Unncessary changes are happening.

@AnaghHegde what exactly are the unexpected/unnecessary changes you encountered? Just mentioning "unexpected/unnecessary changes" does not help for us to help troubleshooting.

What should i need to post?. The changed html files ?.

@AnaghHegde yes, whatever you think will help us in troubleshooting.

Take a look at this. I am using God Mode on these tests. You can check the logs here after the god mode also please see the error message at the end.

I don't understand why the build says such error Please append a unique id (e.g your name) to each of the default account in test.properties in order to use God mode, e.g change alice.tmms to alice.tmms.<yourName>, charlie.tmms to charlie.tmms.<yourName>, etc. which works totally fine in my local environment.

Firstly, in the Travis CI build log, it is showing a mismatch of expected HTML and original HTML. You have added id="endTime" in feedbackSessionDetailsPanel.tag. During the tests, what is happening is that the test compares the HTML in src/test/resources/pages/newlyJoinedInstructorStudentFeedbackSubmissionEdit.html (this is the expected HTML) with what is generated. I deduced this by following -

at teammates.test.driver.HtmlHelper.assertSameHtml(HtmlHelper.java:85)
at teammates.test.driver.HtmlHelper.assertSameHtml(HtmlHelper.java:53)
at teammates.test.pageobjects.AppPage.verifyHtmlPart(AppPage.java:850)
at teammates.test.pageobjects.AppPage.verifyHtmlMainContent(AppPage.java:903)
at teammates.test.cases.browsertests.AdminHomePageUiTest.testCreateInstructorAction(AdminHomePageUiTest.java:244)
at teammates.test.cases.browsertests.AdminHomePageUiTest.testAll(AdminHomePageUiTest.java:57)

As newlyJoinedInstructorStudentFeedbackSubmissionEdit.html doesn't have id="endTime" mismatch occurs and test fails. So if you add id="endTime" in newlyJoinedInstructorStudentFeedbackSubmissionEdit.html you test should pass. Is doing that legit? I'll leave it up to you.

As for test.properties, you should append something like your name, eg. this is how my file looks -

# The Google account of a user that has 'admin access' to the application
# For testing against staging server, you should use your own google account here.
# Omit '@gmail.com'
test.admin.account=yourGoogleId.VamsiSangam
test.admin.password=adminpassword

# This Google account will be given 'instructor access' to the application.
# For testing against a production server, replace it with details of a real GMail account.
test.instructor.account=teammates.coord.VamsiSangam
test.instructor.password=anypassword

# These two Google accounts will be given 'student access' to the application.
test.student1.account=alice.tmms.VamsiSangam
test.student1.password=anypassword
test.student2.account=charlie.tmms.VamsiSangam
test.student2.password=anypassword

# A Google account will not be given access to the application.
test.unreg.account=teammates.unreg.VamsiSangam
test.unreg.password=anypassword

@VamsiSangam

As newlyJoinedInstructorStudentFeedbackSubmissionEdit.html doesn't have id="endTime" mismatch occurs and test fails. So if you add id="endTime" in newlyJoinedInstructorStudentFeedbackSubmissionEdit.html you test should pass.

I know the reason for it,i also know that if i just id=endTime in the *.html files it works. But thats not the best way, for that reason only GodMode is there. Did you take a look at this ? i assume not. So my question is after running the GodMode tests why is giving that error?. I assume test.properties is for local environment right?. And this(adding name in test.properties file) part is done during env set-up only.

Yeah you are right. It is mentioned in godmode.md -

DO NOT create or modify the expected html pages in the tests manually.

I took a look at the logs and followed the stack trace. This function gets called -

private static boolean areTestAccountsReadyForGodMode() {
        if (!TEST_STUDENT1_ACCOUNT.startsWith("alice.tmms.")) {
            return false;
        }
        String uniqueId = TEST_STUDENT1_ACCOUNT.substring("alice.tmms.".length());
        if (uniqueId.isEmpty()) {
            return false;
        }

        boolean isSecondStudentAccountReady = ("charlie.tmms." + uniqueId).equals(TEST_STUDENT2_ACCOUNT);
        boolean isInstructorAccountReady = ("teammates.coord." + uniqueId).equals(TEST_INSTRUCTOR_ACCOUNT);
        boolean isAdminAccountReady = ("yourGoogleId." + uniqueId).equals(TEST_ADMIN_ACCOUNT);
        return isSecondStudentAccountReady && isInstructorAccountReady && isAdminAccountReady;
    }

So, the first condition fails if you haven't appended your name in test.properties. I still think what you said -

I assume test.properties is for local environment right?.

makes sense but I think modifying test.properties is worth a shot. :smile:

I did modify the test.properties. Else i can't run the test in godmode.md in my local environment. So i dont know whats happening.

Ok, well our Teammates friends in Singapore are having their exams so I guess they are not able to respond quickly. Meanwhile let us deduce your error as much as possible. Could you please paste the contents of test.properties here? I know you've edited it, but just for reference.

Ok, well our Teammates friends in Singapore are having their exams so I guess they are not able to respond

Yeah. That's true. So the content goes like this.

# The Google account of a user that has 'admin access' to the application
# For testing against staging server, you should use your own google account here.
# Omit '@gmail.com'
test.admin.account=yourGoogleId.anagh
test.admin.password=adminpassword

# This Google account will be given 'instructor access' to the application.
# For testing against a production server, replace it with details of a real GMail account.
test.instructor.account=teammates.coord.anagh
test.instructor.password=anypassword

# These two Google accounts will be given 'student access' to the application.
test.student1.account=alice.tmms.anagh
test.student1.password=anypassword
test.student2.account=charlie.tmms.anagh
test.student2.password=anypassword

# A Google account will not be given access to the application.
test.unreg.account=teammates.unreg.anagh
test.unreg.password=anypassword

@sujeet14108 I think you have recently tried the GodMode. Any suggestions?.

Hey @AnaghHegde, the fact that that message appeared in the build log tells me that you were trying to run GodMode on Travis. GodMode is only meant to be run locally - as soon as the HTML files have been updated, GodMode should be turned back off.

After taking a look at commit 3360e7b linked from the failed build, my suspicions were confirmed. I guess you forgot to turn GodMode off before committing?

@whipermr5 Yes. Nice catch. While committing i forgot to turn it off. But later i have changed it to false. Hence it's working fine. Thank you for pointing it out.

@AnaghHegde Yes i have used GodeMode but i have not faced any problem using it and worked perfectly. Also what Whipmer5 is indicating may be that's the issue
Update : Saw your comment later. Good to see its resolved :+1:

@sujeet14108 Yes. That's the reason i guess. Thanks for all the help @whipermr5 @VamsiSangam @wkurniawan07 @sujeet14108 .

Was this page helpful?
0 / 5 - 0 ratings